[PATCH] D69009: [IndVars] Eliminate loop exits with equivalent exit counts

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 01:11:05 PDT 2019


ebrevnov added inline comments.


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2758
+  SmallSet<const SCEV*, 8> DominatingExitCounts;
+  for (BasicBlock *ExitingBB : ExitingBlocks) {
+    // If our exitting block exits multiple loops, we can only rewrite the
----------------
That would be a fourth loop filtering out "bad" exits before actual work. And the method becomes pretty long. I think we need to refactor in this or consequent patch. 


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2793
+    // strictly follows another which does the same and is thus dead.
+    if (!DominatingExitCounts.insert(ExitCount).second) {
+      bool ExitIfTrue = !L->contains(*succ_begin(ExitingBB));
----------------
Two notes here. 1) Any reason not to use isKnownViaNonRecursiveReasoning or isKnownPredicate? 2) We can actually eliminate an exit if its exit count not less than exit count of one of its predecessors.

None of these is blocking the current patch though.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69009





More information about the llvm-commits mailing list