[PATCH] D11278: [IndVars] Make loop varying predicates loop invariant.

Philip Reames listmail at philipreames.com
Tue Jul 21 14:34:07 PDT 2015

reames added a comment.

LGTM w/comments addressed.  I would prefer to have another set of eyes on it (Andy?, 
Nick?) before submission though.  I'm fairly sure of the algorithm involved, but am not entirely familiar with the code involved.

Comment at: lib/Analysis/ScalarEvolution.cpp:6634
@@ +6633,3 @@
+  Increasing = IncreasingA;
+  return ResultA;
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.

Comment at: lib/Analysis/ScalarEvolution.cpp:6677
@@ +6676,3 @@
+  if (isKnownNonNegative(LHS->getStepRecurrence(*this))) {
+    Increasing = IncreasingOnNonNegativeStep;
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.


More information about the llvm-commits mailing list