[PATCH] D108651: [SCEV] Use no-self-wrap flags infered from exit structure to compute trip count

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 16:06:29 PDT 2021


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM.  Sorry about the delay.

(Please clang-format the patch.)



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11626
+
+          setNoWrapFlags(const_cast<SCEVAddRecExpr *>(AR), Flags);
+        }
----------------
reames wrote:
> efriedma wrote:
> > Can we move this logic to computeExitLimitFromICmp, or maybe even createAddRecFromPHI? It's basically independent of the predicate.
> We can move it out to the caller (computeExitLimitFromICmp), though I'd strongly prefer to land this and then do the move with separate tests added.  
> 
> I'd argue not in createAddRecFromPHI as I don't want to add the use list walk which would be required there.  
> I'd argue not in createAddRecFromPHI as I don't want to add the use list walk which would be required there.

I think we already do a similar sort of walk to try to prove poison?  Maybe worth looking into.  But not a priority, sure; the nowrap is less likely to be useful in other contexts.


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

https://reviews.llvm.org/D108651



More information about the llvm-commits mailing list