Minor code simplifications. Don't attempt LSR on theoretical

targets with pointers larger than 64 bits, due to the code not
yet being APInt clean.

llvm-svn: 69296
This commit is contained in:
Dan Gohman 2009-04-16 16:49:48 +00:00
parent 67ad4ee457
commit f2bec6720f

View File

@ -489,8 +489,7 @@ bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L,
return false; // Void and FP expressions cannot be reduced. return false; // Void and FP expressions cannot be reduced.
// LSR is not APInt clean, do not touch integers bigger than 64-bits. // LSR is not APInt clean, do not touch integers bigger than 64-bits.
if (I->getType()->isInteger() && if (TD->getTypeSizeInBits(I->getType()) > 64)
I->getType()->getPrimitiveSizeInBits() > 64)
return false; return false;
if (!Processed.insert(I)) if (!Processed.insert(I))
@ -2075,16 +2074,11 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
if (RequiresTypeConversion(NewCmpTy, CmpTy)) { if (RequiresTypeConversion(NewCmpTy, CmpTy)) {
// Check if it is possible to rewrite it using // Check if it is possible to rewrite it using
// an iv / stride of a smaller integer type. // an iv / stride of a smaller integer type.
bool TruncOk = false; unsigned Bits = NewTyBits;
if (NewCmpTy->isInteger()) { if (ICmpInst::isSignedPredicate(Predicate))
unsigned Bits = NewTyBits; --Bits;
if (ICmpInst::isSignedPredicate(Predicate)) uint64_t Mask = (1ULL << Bits) - 1;
--Bits; if (((uint64_t)NewCmpVal & Mask) != (uint64_t)NewCmpVal)
uint64_t Mask = (1ULL << Bits) - 1;
if (((uint64_t)NewCmpVal & Mask) == (uint64_t)NewCmpVal)
TruncOk = true;
}
if (!TruncOk)
continue; continue;
} }