Help with PR12201

I'm trying to fix PR12201, and would like some advice. Here's what is

On PPC32 VAARG is custom lowered (in PPCTargetLowering::LowerVAARG) and
can create two ISD::SELECT nodes that use a ISD::SETCC node with a
ISD::SETLT parameter. On PPC, ISD::SELECT is expanded, and here both
of these SELECT nodes are expanded into ISD::SELECT_CC nodes with
a ISD::SETLT node used by both.

These SELECT_CC nodes are not directly instruction selected, instead
they should be handled by the PPCDAGToDAGISel::Select function. This
function always transforms SELECT_CC nodes into PPC-specific nodes that
can be instruction selected; in doing so the ISD::SETLT (and all
similar comparison operator nodes) should be dropped (they are not used
in the node passed to CurDAG->SelectNodeTo).

During instruction selected, PPCDAGToDAGISel::Select is called once on
one of the SELECT_CC nodes, and then sometime later, CodeGen attempts
to instruction-select the SETLT node (which fails, thus the bug). I
don't understand why PPCDAGToDAGISel::Select would be called only on
one of the SELECT_CC nodes, and I don't know if the lack of a second
call (prior to the failure) is even part of the problem. This is a
bottom-up process, right? Does anyone have any ideas on for what I
should be looking?

There is a reduced test case and some notes in the PR:

Thanks again,