From 91b9ad182411153608d5bb4232209f3b5fd6bd6b Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 10 Feb 2008 08:10:24 +0000 Subject: [PATCH] Return "(c1 + c2)" instead of yet another ADD node (which made this a no-op). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46922 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index be4e0102cc9..3a03f2c4bfb 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -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); -- 2.34.1