[PATCH] D31403: [SDAG] Deal with deleted node in PromoteIntShiftOp

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 06:53:33 PDT 2017


niravd marked 3 inline comments as done.
niravd added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1166-1169
+    if (Replace) {
+      AddToWorklist(N0.getNode());
       ReplaceLoadWithPromotedLoad(Op.getOperand(0).getNode(), N0.getNode());
+    }
----------------
spatel wrote:
> Only the 'PromoteOperand' path can set 'Replace' to true, right? Can you move this into that else clause, and move the 'Replace' declaration into that else clause too?
Yes, but it would require us to duplicate the construction of RV which needs to be after the N0 change but before the replaceload call so in case N0 and N1 are closely related so we don't end up with a stale N1 value (another bug we've caught onto recently, e.g. https://reviews.llvm.org/D31148).

Given that I think this way is cleaner. 


https://reviews.llvm.org/D31403





More information about the llvm-commits mailing list