diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-05-11 01:32:59 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-05-11 01:32:59 +0000 |
| commit | e0a64d83fc441b4d4506cf1fd8a6d5e9e061a987 (patch) | |
| tree | f8343c465ad7366575f4731152bad5ac6bbcab83 /llvm/lib | |
| parent | dc8ad0058f7ab81a71ddb6f453b2eaf37e1923ba (diff) | |
| download | bcm5719-llvm-e0a64d83fc441b4d4506cf1fd8a6d5e9e061a987.tar.gz bcm5719-llvm-e0a64d83fc441b4d4506cf1fd8a6d5e9e061a987.zip | |
Fix a minor logic mistake transforming compares in instcombine. PR12514.
llvm-svn: 156600
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index ab2987ff24c..7bbdd450f11 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1035,7 +1035,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, if ((KnownZero|KnownOne).countLeadingOnes() >= SrcBits-DstBits) { // Pull in the high bits from known-ones set. APInt NewRHS = RHS->getValue().zext(SrcBits); - NewRHS |= KnownOne; + NewRHS |= KnownOne & APInt::getHighBitsSet(SrcBits, SrcBits-DstBits); return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0), ConstantInt::get(ICI.getContext(), NewRHS)); } |

