aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-12-02 05:12:47 +0000
committerBill Wendling <isanbard@gmail.com>2008-12-02 05:12:47 +0000
commitd0a76ee515a049990d2a7aec890dcb793e062b45 (patch)
tree8f318350141d6e909228a4914fe8b404b4c2f0c9 /lib/Transforms/Scalar/InstructionCombining.cpp
parent236a119dc811552af28e6a9908127b8ad7fb36b0 (diff)
downloadexternal_llvm-d0a76ee515a049990d2a7aec890dcb793e062b45.zip
external_llvm-d0a76ee515a049990d2a7aec890dcb793e062b45.tar.gz
external_llvm-d0a76ee515a049990d2a7aec890dcb793e062b45.tar.bz2
- Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
constant. If X is a constant, then this is folded elsewhere. - Added a note to Target/README.txt to indicate that we'd like to implement this when we're able. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 7ad75d2..34c5fb3 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2929,18 +2929,6 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
// sdiv X, -1 == -X
if (RHS->isAllOnesValue())
return BinaryOperator::CreateNeg(Op0);
-
- // -X/C -> X/-C, if and only if negation doesn't overflow.
- if (Value *LHSNeg = dyn_castNegVal(Op0)) {
- if (ConstantInt *CI = dyn_cast<ConstantInt>(LHSNeg)) {
- Constant *RHSNeg = ConstantExpr::getNeg(RHS);
- if (RHS != RHSNeg) { // Check that there is no overflow.
- Constant *CINeg = ConstantExpr::getNeg(CI);
- if (CI != CINeg) // Check that there is no overflow.
- return BinaryOperator::CreateSDiv(LHSNeg, RHSNeg);
- }
- }
- }
}
// If the sign bits of both operands are zero (i.e. we can prove they are