[PATCH] D136415: [LSR] Check if terminating value is safe to expand before transformation

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 13:35:10 PDT 2022


Meinersbur added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6825
       // TermValue = Start + Stride * (BackedgeCount + 1)
       const SCEV *TermValueS = SE.getAddExpr(
           AddRec->getOperand(0),
----------------
JojoR wrote:
> eopXD wrote:
> > JojoR wrote:
> > > The patch looks good to me,
> > > but the implementation is redundant with here ?
> > > it should merge into one ?
> > Sorry, may you explain more on the redundancy you see here.
> Looks only one expression, ignore this comment.
> my original consideration is that put same action/checker into one place, it's ok also here :)
Could you explain why the `TermValueS` that that is checked by `Expander.isSafeToExpand` before this patch is different than the `TermValueS` in `IsToHelpFold` after this patch?


================
Comment at: llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold-negative-testcase.ll:224
+define i64 @alac_seek(ptr %0) {
+;CHECK: Is not safe to expand terminating value for phi node  %indvars.iv.i = phi i64 [ 0, %entry ], [ %indvars.iv.next.i, %for.body.i ]
+entry:
----------------
[nit]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136415



More information about the llvm-commits mailing list