Return "(c1 + c2)" instead of yet another ADD node (which made this a
authorBill Wendling <isanbard@gmail.com>
Sun, 10 Feb 2008 08:10:24 +0000 (08:10 +0000)
committerBill Wendling <isanbard@gmail.com>
Sun, 10 Feb 2008 08:10:24 +0000 (08:10 +0000)
no-op).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46922 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index be4e0102cc95403a280d745d0ad3b65ea6747bfd..3a03f2c4bfb08845e8df8864a6701ad695d1a5fb 100644 (file)
@@ -923,7 +923,7 @@ SDOperand DAGCombiner::visitADD(SDNode *N) {
     return N1;
   // fold (add c1, c2) -> c1+c2
   if (N0C && N1C)
-    return DAG.getNode(ISD::ADD, VT, N0, N1);
+    return DAG.getConstant(N0C->getValue() + N1C->getValue(), VT);
   // canonicalize constant to RHS
   if (N0C && !N1C)
     return DAG.getNode(ISD::ADD, VT, N1, N0);