[PATCH] D109457: [SCEV] Use constant range of RHS to prove NUW on narrow IV in trip count logic

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 10:50:18 PDT 2021


reames updated this revision to Diff 385125.
reames added a comment.

Drop the must-exit logic entirely.  As recently demonstrated in the indvars approach, none of the original motivating examples actually require it after we incorporate more precise range reasoning.

Add applyLoopGuards to constrain RHS, and fix an off by one bug which resulted in inprecise results at the edge.  Additionally, include tests specifically focused on the edge case to demonstrate the correctness of said change.

As can now be seen by the test changes in finite-exit-comparisons.ll (the test file exercising the new indvars logic), this sometimes lets us to LFTR an exit test instead of rotating/narrowing.  I've manually confirmed that we generate exit tests for all of the examples, why some still hit the rotate path will be investigated separately.  I'm hoping to be able to delete that logic again entirely, but well, we'll see.


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

https://reviews.llvm.org/D109457

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll
  llvm/test/Transforms/IndVarSimplify/finite-exit-comparisons.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109457.385125.patch
Type: text/x-patch
Size: 12614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/78dfefe6/attachment.bin>


More information about the llvm-commits mailing list