[PATCH] D20315: [LV] For some induction variables, use vector phis instead of widening the scalar in the loop body
Elena Demikhovsky via llvm-commits
llvm-commits at lists.llvm.org
Tue May 31 13:03:29 PDT 2016
delena added inline comments.
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2118
@@ +2117,3 @@
+ ConstantInt *Step = II.getConstIntStepValue();
+
+ // Construct the initial value of the vector IV in the vector loop preheader
----------------
mkuper wrote:
> delena wrote:
> > Check (Step != 0) here.
> There's already an assert that this is non-null before each callsite. Do you want another assert here?
Probably yes..
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2121
@@ +2120,3 @@
+ auto CurrIP = Builder.saveIP();
+ Builder.SetInsertPoint(LoopVectorPreHeader->getTerminator());
+ if (TruncType) {
----------------
I assume that loop invariant code will be hoisted anyway.
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4295
@@ +4294,3 @@
+ IntegerType *TruncType = cast<IntegerType>(CI->getType());
+ StepValue = ConstantInt::getSigned(TruncType, StepValue->getSExtValue());
+ if (VF == 1) {
----------------
this line should be moved down, under the if (VF==1)
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4306
@@ +4305,3 @@
+ // a new, truncated, vector IV based on that.
+ assert(II.getConstIntStepValue() &&
+ "Primary induction variable should have a const step");
----------------
you don't need assert here, you are under the "if"
http://reviews.llvm.org/D20315
More information about the llvm-commits
mailing list