[PATCH] D11278: [IndVars] Make loop varying predicates loop invariant.
Andrew Trick
atrick at apple.com
Sun Jul 26 18:27:09 PDT 2015
atrick accepted this revision.
atrick added a comment.
This revision is now accepted and ready to land.
LGTM. Nice optimization.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:6634
@@ +6633,3 @@
+
+ Increasing = IncreasingA;
+ return ResultA;
----------------
reames wrote:
> Rather than sharing the work, it might be cleaner to just put this block standalone in it's own scope and reuse the NDEBUG code even in debug. It makes it less likely you'll have a NDEBUG only error.
I think it would be slightly preferable to have:
bool Result = isMonotonicPredicateImpl(...);
#ifndef NDEBUG
bool SwappedResult = ...
assert(...)
#endif
return Result;
================
Comment at: lib/Analysis/ScalarEvolution.cpp:6677
@@ +6676,3 @@
+
+ if (isKnownNonNegative(LHS->getStepRecurrence(*this))) {
+ Increasing = IncreasingOnNonNegativeStep;
----------------
reames wrote:
> Your reasoning about the zero case should be here in a comment. It makes perfect sense once explained, but isn't obvious from the code.
Definitely.
http://reviews.llvm.org/D11278
More information about the llvm-commits
mailing list