[PATCH] D19258: Loop vectorization with induction variable with non-constant step.
Matthew Simpson via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 11:40:44 PDT 2016
mssimpso added a subscriber: mssimpso.
================
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;
----------------
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.
Repository:
rL LLVM
http://reviews.llvm.org/D19258
More information about the llvm-commits
mailing list