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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 11:44:53 PDT 2019


nikic added inline comments.


================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:2796
+      continue;
+    }
   }
----------------
Now that we're traversing the exits in dominating order, I think we should consider a slightly different overall approach:

Instead of computing `umin({ exit counts })` upfront and then checking for `umin({ exit counts }) < this exit count`, we can instead build this up incrementally, i.e. take the umin between the current max exit count and the exit count of the currently considered exit at each iteration. This will allow us to check for `umin({ already seen exit counts }) <= this exit count` (note the `<=`!) instead.

This should implicitly handle the case of exact equalities, but may also be more powerful in general because we're checking for a weaker predicate.


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

https://reviews.llvm.org/D69009





More information about the llvm-commits mailing list