mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
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
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user