diff options
author | Dale Johannesen <dalej@apple.com> | 2010-11-10 01:30:56 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-11-10 01:30:56 +0000 |
commit | 201ab3acff18c0470950d43495419185e8a7afd3 (patch) | |
tree | 9c9266ad515f515b87c8797bf62c43cb0fbb0fb1 /lib/Transforms | |
parent | 8ea974039a8811ff83ad2c45ec1037ac78e5afab (diff) | |
download | external_llvm-201ab3acff18c0470950d43495419185e8a7afd3.zip external_llvm-201ab3acff18c0470950d43495419185e8a7afd3.tar.gz external_llvm-201ab3acff18c0470950d43495419185e8a7afd3.tar.bz2 |
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')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineShifts.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp index 012d238..9f7d98e 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; } |