Disable (x - (y - z)) => (x + (z - y)) optimization for floating point.
authorChris Lattner <sabre@nondot.org>
Mon, 2 Feb 2004 20:09:56 +0000 (20:09 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 2 Feb 2004 20:09:56 +0000 (20:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11083 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index bc9558e8db140284a4fdb3deac598f92ae2185cf..8a089555b8d13e0189d8032a1bfdc8d51ac8db6d 100644 (file)
@@ -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);