forked from OSchip/llvm-project
Return "(c1 + c2)" instead of yet another ADD node (which made this a
no-op). llvm-svn: 46922
This commit is contained in:
parent
2b8a52e259
commit
9c2ce9a32d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue