[llvm-commits] [llvm] r60137 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Dale Johannesen dalej at apple.com
Wed Nov 26 16:43:21 PST 2008


Author: johannes
Date: Wed Nov 26 18:43:21 2008
New Revision: 60137

URL: http://llvm.org/viewvc/llvm-project?rev=60137&view=rev
Log:
Add a missing case in visitADD.


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=60137&r1=60136&r2=60137&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 26 18:43:21 2008
@@ -1010,6 +1010,9 @@
   // 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);





More information about the llvm-commits mailing list