Use TargetData::getTypeSizeInBits instead of getPrimitiveSizeInBits()

to get the correct answer for pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-04-16 22:35:57 +00:00
parent d305e707a6
commit 84fc33ed92

View File

@ -1868,13 +1868,13 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
// it here. // it here.
if (!ReuseIV.Base->isZero()) { if (!ReuseIV.Base->isZero()) {
SCEVHandle typedBase = ReuseIV.Base; SCEVHandle typedBase = ReuseIV.Base;
if (RewriteExpr->getType()->getPrimitiveSizeInBits() != if (TD->getTypeSizeInBits(RewriteExpr->getType()) !=
ReuseIV.Base->getType()->getPrimitiveSizeInBits()) { TD->getTypeSizeInBits(ReuseIV.Base->getType())) {
// It's possible the original IV is a larger type than the new IV, // It's possible the original IV is a larger type than the new IV,
// in which case we have to truncate the Base. We checked in // in which case we have to truncate the Base. We checked in
// RequiresTypeConversion that this is valid. // RequiresTypeConversion that this is valid.
assert (RewriteExpr->getType()->getPrimitiveSizeInBits() < assert(TD->getTypeSizeInBits(RewriteExpr->getType()) <
ReuseIV.Base->getType()->getPrimitiveSizeInBits() && TD->getTypeSizeInBits(ReuseIV.Base->getType()) &&
"Unexpected lengthening conversion!"); "Unexpected lengthening conversion!");
typedBase = SE->getTruncateExpr(ReuseIV.Base, typedBase = SE->getTruncateExpr(ReuseIV.Base,
RewriteExpr->getType()); RewriteExpr->getType());