[PATCH] D104066: [SCEV] Use knowledge of stride to prove loops finite for LT exit count computation
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 11 02:51:54 PDT 2021
mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.
Looks fine, but agreed with Eli. Please don't land it for some more days to find and fix miscompiles from underlying patches (if any).
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11479
+
+ if (PredicatedIV || !NoWrap || isKnownNonPositive(Stride) || !StrideNonZero)
return getCouldNotCompute();
----------------
Please refactor as
```
if (PredicatedIV || !NoWrap || isKnownNonPositive(Stride))
return getCouldNotCompute();
bool StrideNonZero = loopIsFiniteByAssumption || isLoopEntryGuardedByCond ...
if (!StrideNonZero )
return getCouldNotCompute();
```
The dom tree walking is expensive, let's only do it if easy checks failed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104066/new/
https://reviews.llvm.org/D104066
More information about the llvm-commits
mailing list