summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-06 00:51:48 +0000
committerDan Gohman <gohman@apple.com>2008-05-06 00:51:48 +0000
commitcf0e3acf164bc75f06c2483433e0e584d1545bea (patch)
tree6a6f3811f0aebfefeed3310fdda07f99207699f5 /llvm/lib/Transforms/Scalar
parent222c6123df749aa0e0b73b4d16c701ffcfca3caf (diff)
downloadbcm5719-llvm-cf0e3acf164bc75f06c2483433e0e584d1545bea.tar.gz
bcm5719-llvm-cf0e3acf164bc75f06c2483433e0e584d1545bea.zip
Correct the value of LowBits in srem and urem handling in
ComputeMaskedBits. llvm-svn: 50692
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-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 6b1da0d2565..461d5fc7803 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -965,7 +965,7 @@ void InstCombiner::ComputeMaskedBits(Value *V, const APInt &Mask,
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
APInt RA = Rem->getValue();
if (RA.isPowerOf2() || (-RA).isPowerOf2()) {
- APInt LowBits = RA.isStrictlyPositive() ? ((RA - 1) | RA) : ~RA;
+ APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) : ~RA;
APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);
ComputeMaskedBits(I->getOperand(0), Mask2,KnownZero2,KnownOne2,Depth+1);
@@ -986,8 +986,8 @@ void InstCombiner::ComputeMaskedBits(Value *V, const APInt &Mask,
case Instruction::URem: {
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
APInt RA = Rem->getValue();
- if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
- APInt LowBits = (RA - 1) | RA;
+ if (RA.isPowerOf2()) {
+ APInt LowBits = (RA - 1);
APInt Mask2 = LowBits & Mask;
KnownZero |= ~LowBits & Mask;
ComputeMaskedBits(I->getOperand(0), Mask2, KnownZero, KnownOne,Depth+1);
@@ -1728,7 +1728,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
APInt RA = Rem->getValue();
if (RA.isPowerOf2() || (-RA).isPowerOf2()) {
- APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) | RA : ~RA;
+ APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) : ~RA;
APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);
if (SimplifyDemandedBits(I->getOperand(0), Mask2,
LHSKnownZero, LHSKnownOne, Depth+1))
@@ -1749,8 +1749,8 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
case Instruction::URem: {
if (ConstantInt *Rem = dyn_cast<ConstantInt>(I->getOperand(1))) {
APInt RA = Rem->getValue();
- if (RA.isStrictlyPositive() && RA.isPowerOf2()) {
- APInt LowBits = (RA - 1) | RA;
+ if (RA.isPowerOf2()) {
+ APInt LowBits = (RA - 1);
APInt Mask2 = LowBits & DemandedMask;
KnownZero |= ~LowBits & DemandedMask;
if (SimplifyDemandedBits(I->getOperand(0), Mask2,
OpenPOWER on IntegriCloud