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

Yueh-Ting (eop) Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 01:55:31 PDT 2022


eopXD 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),
----------------
Meinersbur wrote:
> 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?
`TermValueS` calculation does not change before/after this patch. The addition here is to guard the expansion of it by checking if it is safe in the legalization of this terminating condition fold transformation.


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