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
This commit is contained in:
Chris Lattner 2004-02-02 20:09:56 +00:00
parent 529429224c
commit 0517e72096

View 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);