[PATCH] D98222: [SCEV] Use trip count information to improve shift recurrence ranges

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 12 13:06:39 PST 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5665
+    return CR;
+
+  unsigned TC = getSmallConstantMaxTripCount(L);
----------------
reames wrote:
> mkazantsev wrote:
> > Are we missing a check that another operand is loop-invariant, or it is implied by something?
> We are, good catch.
Actually, now that I think about it further, we don't need the check. 

Consider the non-invariant case.  The known bits must hold for step on each iteration individually.  As a result, they must be a conservative result for the value of step on all iterations.  As such, if step is loop variant, we'll get a loose bound on the total step.

Instead of adding a bailout, I'll add a test for this case.


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

https://reviews.llvm.org/D98222



More information about the llvm-commits mailing list