From 56eca9103ecbf2293842bfd6067ac26629221eaf 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60137 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); -- 2.34.1