summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineShifts.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-11-10 01:30:56 +0000
committerDale Johannesen <dalej@apple.com>2010-11-10 01:30:56 +0000
commit201ab3acff18c0470950d43495419185e8a7afd3 (patch)
tree9c9266ad515f515b87c8797bf62c43cb0fbb0fb1 /lib/Transforms/InstCombine/InstCombineShifts.cpp
parent8ea974039a8811ff83ad2c45ec1037ac78e5afab (diff)
downloadllvm-201ab3acff18c0470950d43495419185e8a7afd3.tar.gz
llvm-201ab3acff18c0470950d43495419185e8a7afd3.tar.bz2
llvm-201ab3acff18c0470950d43495419185e8a7afd3.tar.xz
When checking that the necessary bits are zero in
order to reduce ((x<<30)>>24) to x<<6, check the correct bits. PR 8547. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118665 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineShifts.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineShifts.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 012d238729..9f7d98ed79 100644
--- a/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -131,9 +131,9 @@ static bool CanEvaluateShifted(Value *V, unsigned NumBits, bool isLeftShift,
// We can turn shl(c1)+shr(c2) -> shl(c3)+and(c4), but it isn't
// profitable unless we know the and'd out bits are already zero.
if (CI->getZExtValue() > NumBits) {
- unsigned HighBits = CI->getZExtValue() - NumBits;
+ unsigned LowBits = TypeWidth - CI->getZExtValue();
if (MaskedValueIsZero(I->getOperand(0),
- APInt::getHighBitsSet(TypeWidth, HighBits)))
+ APInt::getLowBitsSet(TypeWidth, NumBits) << LowBits))
return true;
}