diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-09 16:32:32 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-09 16:32:32 +0000 |
commit | 21b972ae9497b79af7320b9ff5a7ef28c5aab900 (patch) | |
tree | 8c7049e0d6db2844e4bf098a45f120738998ac2f /llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | |
parent | e46dd48e9fe535825bc81e44c8863b0ee5b44354 (diff) | |
download | llvm-21b972ae9497b79af7320b9ff5a7ef28c5aab900.zip llvm-21b972ae9497b79af7320b9ff5a7ef28c5aab900.tar.gz llvm-21b972ae9497b79af7320b9ff5a7ef28c5aab900.tar.bz2 |
InstCombine: Don't just copy known bits from the first operand of an srem.
That's obviously wrong. Conservatively restrict it to the sign bit, which
matches the original intention of this analysis. Fixes PR15940.
llvm-svn: 181518
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 8add1ea..a7bfe09 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -754,7 +754,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, ComputeMaskedBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth+1); // If it's known zero, our sign bit is also zero. if (LHSKnownZero.isNegative()) - KnownZero |= LHSKnownZero; + KnownZero.setBit(KnownZero.getBitWidth() - 1); } break; case Instruction::URem: { |