[PATCH] D19258: Loop vectorization with induction variable with non-constant step.
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 07:41:05 PDT 2016
hfinkel added inline comments.
================
Comment at: ../lib/Transforms/Utils/LoopUtils.cpp:738-739
@@ +737,4 @@
+ else {
+ SetVector<Value *> *Set = SE->getSCEVValues(Step);
+ if (!Set || Set->size() != 1)
+ return false;
----------------
mssimpso wrote:
> delena wrote:
> > hfinkel wrote:
> > > I don't think this is a good way to handle this, because we'll run into all kinds of non-trivial situations where SCEV has computed an expression for the step that does not exactly correspond to a pre-existing IR value. We won't handle those cases, and it will be nearly impossible for a user to understand why.
> > >
> > > Instead, convert StepValue in InductionDescriptor to a const SCEV *, and then when we need the Value* when generating IR, get one from the SCEVBuilder. It will reuse an existing Value* should one exist.
> > I can't find a way to build a Value from SCEV. If the Step is "SCEVAddRecExpr", how do I get Value* from it?
> Elena,
>
> I think Hal was suggesting you use a SCEVExpander to build a Value from a SCEV expression. SCEVExpander's are used elsewhere in the loop vectorizer.
Yes, exactly. SCEVExpander will reuse an existing value if an appropriate one is known, or otherwise materialize some appropriate IR value.
Repository:
rL LLVM
http://reviews.llvm.org/D19258
More information about the llvm-commits
mailing list