diff options
| author | Owen Anderson <resistor@mac.com> | 2010-12-23 23:56:24 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2010-12-23 23:56:24 +0000 |
| commit | 226ac14afb74b67007d133e3bb16ca05642b4caa (patch) | |
| tree | adccd9485f5b9996ee274e5f23b3536d0eee0bba /llvm/lib/Transforms | |
| parent | 62de0fa6719601358b9bbe9e4d5db0d5fc552979 (diff) | |
| download | bcm5719-llvm-226ac14afb74b67007d133e3bb16ca05642b4caa.tar.gz bcm5719-llvm-226ac14afb74b67007d133e3bb16ca05642b4caa.zip | |
When determining if we can fold (x >> C1) << C2, the bits that we need to verify are zero
are not the low bits of x, but the bits that WILL be the low bits after the operation completes.
llvm-svn: 122529
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index e3232a491b7..a0c5ef5338f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -168,8 +168,9 @@ static bool CanEvaluateShifted(Value *V, unsigned NumBits, bool isLeftShift, // We can always turn lshr(c1)+shl(c2) -> lshr(c3)+and(c4), but it isn't // profitable unless we know the and'd out bits are already zero. if (CI->getZExtValue() > NumBits) { + unsigned LowBits = CI->getZExtValue() - NumBits; if (MaskedValueIsZero(I->getOperand(0), - APInt::getLowBitsSet(TypeWidth, NumBits))) + APInt::getLowBitsSet(TypeWidth, NumBits) << LowBits)) return true; } |

