diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-01-13 07:56:29 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-01-13 07:56:29 +0000 |
commit | b6db95f42b7c3b58f980e387d20ddb3e16bffd56 (patch) | |
tree | dccd21fe81edd340801da46b76a4628b32d9de32 /lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | 981308cffbfd1f77750452015f6e6f0f053e11d4 (diff) |
Fix PR14547. Handle induction variables of small sizes smaller than i32 (i8 and i16).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172348 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 4bb8c43656..464ed97506 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -1033,11 +1033,14 @@ InnerLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) { // We may need to extend the index in case there is a type mismatch. // We know that the count starts at zero and does not overflow. + unsigned IdxTyBW = IdxTy->getScalarSizeInBits(); if (Count->getType() != IdxTy) { // The exit count can be of pointer type. Convert it to the correct // integer type. if (ExitCount->getType()->isPointerTy()) Count = CastInst::CreatePointerCast(Count, IdxTy, "ptrcnt.to.int", Loc); + else if (IdxTyBW < Count->getType()->getScalarSizeInBits()) + Count = CastInst::CreateTruncOrBitCast(Count, IdxTy, "tr.cnt", Loc); else Count = CastInst::CreateZExtOrBitCast(Count, IdxTy, "zext.cnt", Loc); } |