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 | 40e45eeae2da45903a73d4fb5c4bfd4cb9c1e936 (patch) | |
tree | 56bb69c1905a566c7741a4e741fa984de74bdef2 /llvm/lib/Transforms | |
parent | 1a89fe554b5a1bc65662547db62a888b6fa0d05f (diff) | |
download | bcm5719-llvm-40e45eeae2da45903a73d4fb5c4bfd4cb9c1e936.tar.gz bcm5719-llvm-40e45eeae2da45903a73d4fb5c4bfd4cb9c1e936.zip |
Fix PR14547. Handle induction variables of small sizes smaller than i32 (i8 and i16).
llvm-svn: 172348
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 4bb8c436564..464ed97506f 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/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); } |