[PATCH] D107692: [DAGCombine] Prevent the transform of combine for multi-use operand

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 7 07:35:32 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4944
   if (N0.getOpcode() == ISD::ADD && N1.getOpcode() == ISD::SRL &&
-      VT.getSizeInBits() <= 64) {
+      VT.getSizeInBits() <= 64 && N0.hasOneUse()) {
     if (ConstantSDNode *ADDI = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
----------------
lebedev.ri wrote:
> dmgreen wrote:
> > N0->hasOneUse() would probably be better, to check the Node has one use not the SDValue. (Although here it likely won't make much difference.)
> *Why* does it matter for the correctness whether the node has other uses or not?
> The peephole should only affect the current root use we started with,
> and not affect any other uses whatsoever.
There is a CombineTo call on N0. That will affect all users of N0.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107692/new/

https://reviews.llvm.org/D107692



More information about the llvm-commits mailing list