summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-03-12 05:44:52 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-03-12 05:44:52 +0000
commitb3e00c4656c69138f6d687584e9859a8a89d9b38 (patch)
tree2ecccd7523aa3449035257218c15fdd4b58a60c8 /llvm/lib/Transforms
parente8e618a6ffcd2f04b4def681e1118cb8341e2e87 (diff)
downloadbcm5719-llvm-b3e00c4656c69138f6d687584e9859a8a89d9b38.tar.gz
bcm5719-llvm-b3e00c4656c69138f6d687584e9859a8a89d9b38.zip
In function ComputeMaskedBits():
1. Replace getSignedMinValue() with getSignBit() for better code readability. 2. Replace APIntOps::shl() with operator<<= for convenience. 3. Make APInt construction more effective. llvm-svn: 35060
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 79ad33697c7..abb279f7740 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -695,7 +695,7 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
// If the sign bit of the input is known set or clear, then we know the
// top bits of the result.
- APInt InSignBit(APInt::getSignedMinValue(SrcTy->getBitWidth()));
+ APInt InSignBit(APInt::getSignBit(SrcTy->getBitWidth()));
InSignBit.zextOrTrunc(BitWidth);
if ((KnownZero & InSignBit) != 0) { // Input sign bit known zero
KnownZero |= NewBits;
@@ -716,8 +716,8 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
Mask = APIntOps::lshr(Mask, ShiftAmt);
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
- KnownZero = APIntOps::shl(KnownZero, ShiftAmt);
- KnownOne = APIntOps::shl(KnownOne, ShiftAmt);
+ KnownZero <<= ShiftAmt;
+ KnownOne <<= ShiftAmt;
KnownZero |= APInt(BitWidth, 1ULL).shl(ShiftAmt)-1; // low bits known zero.
return;
}
@@ -730,7 +730,7 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
APInt HighBits(APInt::getAllOnesValue(BitWidth).shl(BitWidth-ShiftAmt));
// Unsigned shift right.
- Mask = APIntOps::shl(Mask, ShiftAmt);
+ Mask <<= ShiftAmt;
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);
@@ -747,14 +747,14 @@ static void ComputeMaskedBits(Value *V, APInt Mask, APInt& KnownZero,
APInt HighBits(APInt::getAllOnesValue(BitWidth).shl(BitWidth-ShiftAmt));
// Signed shift right.
- Mask = APIntOps::shl(Mask, ShiftAmt);
+ Mask <<= ShiftAmt;
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1);
assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?");
KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);
KnownOne = APIntOps::lshr(KnownOne, ShiftAmt);
// Handle the sign bits and adjust to where it is now in the mask.
- APInt SignBit = APInt::getSignedMinValue(BitWidth).lshr(ShiftAmt);
+ APInt SignBit(APInt::getSignBit(BitWidth).lshr(ShiftAmt));
if ((KnownZero & SignBit) != 0) { // New bits are known zero.
KnownZero |= HighBits;
OpenPOWER on IntegriCloud