mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
Fix bug 537 test 2, which checks to make sure that we fold A+(B-A) -> B for
integer types. Add a couple checks to not perform these kinds of transform on floating point values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f9c775c22e
commit
41aaf7016e
@ -1183,12 +1183,17 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
|
||||
if (N2.getOpcode() == ISD::SUB && isa<ConstantSDNode>(N2.getOperand(0)) &&
|
||||
cast<ConstantSDNode>(N2.getOperand(0))->getValue() == 0)
|
||||
return getNode(ISD::SUB, VT, N1, N2.getOperand(1)); // A+(0-B) -> A-B
|
||||
if (N2.getOpcode() == ISD::SUB && N1 == N2.Val->getOperand(1) &&
|
||||
!MVT::isFloatingPoint(N2.getValueType()))
|
||||
return N2.Val->getOperand(0); // A+(B-A) -> B
|
||||
break;
|
||||
case ISD::SUB:
|
||||
if (N1.getOpcode() == ISD::ADD) {
|
||||
if (N1.Val->getOperand(0) == N2)
|
||||
if (N1.Val->getOperand(0) == N2 &&
|
||||
!MVT::isFloatingPoint(N2.getValueType()))
|
||||
return N1.Val->getOperand(1); // (A+B)-A == B
|
||||
if (N1.Val->getOperand(1) == N2)
|
||||
if (N1.Val->getOperand(1) == N2 &&
|
||||
!MVT::isFloatingPoint(N2.getValueType()))
|
||||
return N1.Val->getOperand(0); // (A+B)-B == A
|
||||
}
|
||||
if (N2.getOpcode() == ISD::FNEG) // (A- (-B) -> A+B
|
||||
|
Loading…
Reference in New Issue
Block a user