From 0d6dd4bdb9bddd85f53cb5496a215b166a427a83 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 27 Nov 2008 00:43:21 +0000 Subject: [PATCH] Add a missing case in visitADD. llvm-svn: 60137 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 762fcedc7fb..6b35126a10e 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1010,6 +1010,9 @@ SDValue DAGCombiner::visitADD(SDNode *N) { // fold (A+(B-A)) -> B if (N1.getOpcode() == ISD::SUB && N0 == N1.getOperand(1)) return N1.getOperand(0); + // fold ((B-A)+A) -> B + if (N0.getOpcode() == ISD::SUB && N1 == N0.getOperand(1)) + return N0.getOperand(0); if (!VT.isVector() && SimplifyDemandedBits(SDValue(N, 0))) return SDValue(N, 0);