[PATCH] D20932: [LV] Use vector vphis for more induction variables

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 10:46:43 PDT 2016


mkuper added a comment.

Thanks, Elena!
I'll commit this as is, and remove the restriction on types in a separate commit.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2122
@@ -2121,3 +2121,3 @@
     Step = ConstantInt::getSigned(TruncType, Step->getSExtValue());
     Start = Builder.CreateCast(Instruction::Trunc, Start, TruncType);
   }
----------------
delena wrote:
> I thought, that you can put here Builder.CreateSExtOrTrunc(Start, TruncType) , Start and Step should have the  same type anyway.
> You can change name from TruncType to CastType.
> 
> But if I'm wrong, you can submit this patch as is.
There are two places that call widenInductionVariable.
The callsite that calls it with a TruncType will always need a trunc, not a sext, since having a sext there make the transformation unsafe.
The callsite that calls it without a TruncType should, if I'm not mistaken, keep calling it without a TruncType - the type already matches what we want.

So, I'd rather keep it as Instruction::Trunc. SExtOrTrunc will work, but this makes what we want explicit.


http://reviews.llvm.org/D20932





More information about the llvm-commits mailing list