[PATCH] D118808: Loop Strength Reduce - Optimize unused IVs to final values in the exit block with SCEV

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 14:02:01 PST 2022


Whitney added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5605
+// loop which may potentially be optimized with a call to rewriteLoopExitValue.
+bool LoopExitValHasSingleUse(Loop *L) {
+  BasicBlock *LCSSAExitBB = L->getExitBlock();
----------------
make it static


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5606
+bool LoopExitValHasSingleUse(Loop *L) {
+  BasicBlock *LCSSAExitBB = L->getExitBlock();
+  if (!LCSSAExitBB)
----------------
I would just call it ExitBB or ExitBlock.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5618
+    // use for this to be considered.
+    if (IVNext->getNumUses() == 2)
+      return true;
----------------
you can simply `return (IVNext->getNumUses() == 2);`, and you don't really need a loop.


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

https://reviews.llvm.org/D118808



More information about the llvm-commits mailing list