diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-01-14 12:34:31 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-01-14 12:34:31 +0000 |
commit | cfa5f06dde800c9d9207199b3764405aa0afc57e (patch) | |
tree | 5a52cbf5f207c71f943f80f53363799d3b7a0d46 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 4c4c0377ca6c6d35fa60934f1624252c1e38f901 (diff) | |
download | bcm5719-llvm-cfa5f06dde800c9d9207199b3764405aa0afc57e.tar.gz bcm5719-llvm-cfa5f06dde800c9d9207199b3764405aa0afc57e.zip |
[DAGCombiner] Enable add saturation constant folding
llvm-svn: 351060
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 580a668100b..9a40774cff8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2198,8 +2198,9 @@ SDValue DAGCombiner::visitADDSAT(SDNode *N) { // canonicalize constant to RHS if (!DAG.isConstantIntBuildVectorOrConstantInt(N1)) return DAG.getNode(Opcode, DL, VT, N1, N0); - - // TODO Constant Folding + // fold (add_sat c1, c2) -> c3 + return DAG.FoldConstantArithmetic(Opcode, DL, VT, N0.getNode(), + N1.getNode()); } // fold (add_sat x, 0) -> x |