[PATCH] D146811: [LSR] Preserve LCSSA when rewriting instruction with PHI user

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 03:33:42 PDT 2023


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5609
       }
 
       // If LSR splits critical edge and phi node has other pending
----------------
I propose to form `InsertedNonLCSSAInsts` here, because here the order is deterministic.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5654
+  SmallVector<Instruction *, 4> InsertedNonLCSSAInsts;
+  for (auto &[BB, V] : Inserted)
+    if (auto *I = dyn_cast<Instruction>(V))
----------------
The order of iteration here is not deterministic. I don't know if it's a source of any real problem, but we may end up doing slightly different things in different order. If we are especially unlucky, it will be different resulting code. See my other comment where I think it's appropriate to form this vector.



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

https://reviews.llvm.org/D146811



More information about the llvm-commits mailing list