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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 14:09:56 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11626
+
+          setNoWrapFlags(const_cast<SCEVAddRecExpr *>(AR), Flags);
+        }
----------------
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.  


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:11636
+            getZeroExtendExpr(Step, Ty, 0), L, AR->getNoWrapFlags());
+          IV = dyn_cast<SCEVAddRecExpr>(S);
+        }
----------------
efriedma wrote:
> cast<SCEVAddRecExpr>?
At least in theory, this could e.g. be folded to a constant with the additional facts.  It's non ideal that we wouldn't really exploit that, but this can't be a cast.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108651



More information about the llvm-commits mailing list