[PATCH] D139934: [IndVars] Apply more optimistic SkipLastIter for AND/OR conditions
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 04:55:27 PST 2023
mkazantsev added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1490
+ for (size_t j = 0; j < LeafConditions.size(); j++)
+ if (i != j) {
+ auto EL = SE->computeExitLimitFromCond(L, LeafConditions[j], Inverted,
----------------
nikic wrote:
> I don't really get why we need this quadratic-complexity code. It doesn't look like anything inside here depends on the outer `i`?
`OldCond ` depends on outer `i`. The logic here is following: we have `n` conditions joined through `AND`. Currenly we are handing `i`'th condition. If any **other** condition gives exact same exit count as the whole aggregate, it means that the current condition can be handled w/o last iteration. Scanning these other conditions takes linear time (I guess we could cache something if it's a problem, but they can be rewritten, so it's safer not to).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139934/new/
https://reviews.llvm.org/D139934
More information about the llvm-commits
mailing list