aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-02 20:09:56 +0000
committerChris Lattner <sabre@nondot.org>2004-02-02 20:09:56 +0000
commit0517e7209615054b47a57be94e488874850fd5d5 (patch)
treea5a82451b4aa164a9fa59654646a31b653449624
parent529429224c9334ca308e1a8563d03f52196fc342 (diff)
Disable (x - (y - z)) => (x + (z - y)) optimization for floating point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11083 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index bc9558e8db..8a089555b8 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -512,7 +512,8 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
// Replace (x - (y - z)) with (x + (z - y)) if the (y - z) subexpression
// is not used by anyone else...
//
- if (Op1I->getOpcode() == Instruction::Sub) {
+ if (Op1I->getOpcode() == Instruction::Sub &&
+ !Op1I->getType()->isFloatingPoint()) {
// Swap the two operands of the subexpr...
Value *IIOp0 = Op1I->getOperand(0), *IIOp1 = Op1I->getOperand(1);
Op1I->setOperand(0, IIOp1);