[llvm-dev] ISelDAGToDAG breaks node ordering

Dr. ERDI Gergo via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 1 04:03:54 PDT 2017


On Mon, 31 Jul 2017, Friedman, Eli wrote:

> Calling getMergeValues in ISelDAGToDAG is a bad idea; there aren't supposed 
> to be any MERGE_VALUES nodes at that point in the pipeline.
>
> You can call ReplaceUses with SDValues rather than SDNodes.

Oh wow, yes! These are exactly the two pieces of information I was 
missing. This works now:

       SDNode* LDW = CurDAG->getMachineNode(AVR::LDWRdPtr, SDLoc(N), VT, PtrVT, MVT::Other,
                                            LD->getBasePtr(), LD->getChain());
       transferMemOperands(N, LDW);

       ReplaceUses(SDValue(N, 0), SDValue(LDW, 0));
       ReplaceUses(SDValue(N, 1), SDValue(LDW, 2));
       CurDAG->RemoveDeadNode(N);

Thanks a lot!

 	Gergo


More information about the llvm-dev mailing list