aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-11-27 00:43:21 +0000
committerDale Johannesen <dalej@apple.com>2008-11-27 00:43:21 +0000
commite7e5da3e66cf237a697dfb94bcbd0c99668a13e2 (patch)
tree23b19869c9ecc8f1bda680cbbe65d0d5f1c96017 /lib
parentf168a1f93fa994c83b4dddb68b5ced4877c019d7 (diff)
downloadexternal_llvm-e7e5da3e66cf237a697dfb94bcbd0c99668a13e2.zip
external_llvm-e7e5da3e66cf237a697dfb94bcbd0c99668a13e2.tar.gz
external_llvm-e7e5da3e66cf237a697dfb94bcbd0c99668a13e2.tar.bz2
Add a missing case in visitADD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 762fced..6b35126 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);