1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

One more transformation.

llvm-svn: 60432
This commit is contained in:
Dale Johannesen 2008-12-02 18:40:40 +00:00
parent 531472926e
commit c9123e12e3

View File

@ -1025,6 +1025,14 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
return DAG.getNode(ISD::SUB, VT, N1.getOperand(0),
N1.getOperand(1).getOperand(0));
}
// fold (A+((B-A)+-C)) to (B+-C)
if ((N1.getOpcode() == ISD::SUB || N1.getOpcode() == ISD::ADD) &&
N1.getOperand(0).getOpcode() == ISD::SUB &&
N0 == N1.getOperand(0).getOperand(1)) {
return DAG.getNode(N1.getOpcode(), VT, N1.getOperand(0).getOperand(0),
N1.getOperand(1));
}
// fold (A-B)+(C-D) to (A+C)-(B+D) when A or C is constant
if (N0.getOpcode() == ISD::SUB && N1.getOpcode() == ISD::SUB) {
SDValue N00 = N0.getOperand(0);