[PATCH] D147355: [LV] Optimize trip count SCEV.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 10:52:02 PDT 2023


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1005
+        SE.getAddExpr(BackedgeTakenCount,
+                      SE.getOne(BackedgeTakenCount->getType()), SCEV::FlagNUW),
+        IdxTy);
----------------
craig.topper wrote:
> reames wrote:
> > I don't believe the flags usage here is correct.  There's a single SCEV node for an add with given operands.  The flags must be correct for all users of that add expression, and for a loop invariant trip count there's nothing preventing another use outside the loop which does overflow.
> Is the usage in LoopIdiomRecognize wrong too?
Looks that way.  There's might be some non-obvious invariant which lets it be correct, but it's probably just wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147355



More information about the llvm-commits mailing list