diff options
author | Chris Lattner <sabre@nondot.org> | 2003-03-10 23:23:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-03-10 23:23:04 +0000 |
commit | a4f445b28c3c55949e6be72514f4225c95dc87a9 (patch) | |
tree | 046b318be80530803dfa7942e0cd859332f4cdcc | |
parent | 533741a76416f2201252d0210babc64b2a7c904a (diff) |
Implement: -A*-B == A*B
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5740 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 79a551f70c..067a884bc9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -342,6 +342,10 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { } } + if (Value *Op0v = dyn_castNegVal(Op0)) // -X * -Y = X*Y + if (Value *Op1v = dyn_castNegVal(I.getOperand(1))) + return BinaryOperator::create(Instruction::Mul, Op0v, Op1v); + return Changed ? &I : 0; } |