diff options
| author | Nirav Dave <niravd@google.com> | 2019-03-18 17:02:38 +0000 |
|---|---|---|
| committer | Nirav Dave <niravd@google.com> | 2019-03-18 17:02:38 +0000 |
| commit | 55c921f4bf3470126c8eddbd70de6250bc740471 (patch) | |
| tree | 69fd41a8c53990850420b75c78117df8048d0030 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
| parent | c131e0e2ae5447b143686c3aba98f8993f0e5b70 (diff) | |
| download | bcm5719-llvm-55c921f4bf3470126c8eddbd70de6250bc740471.tar.gz bcm5719-llvm-55c921f4bf3470126c8eddbd70de6250bc740471.zip | |
[DAG] Cleanup unused node in SimplifySelectCC.
Delete temporarily constructed node uses for analysis after it's use,
holding onto original input nodes. Ideally this would be rewritten
without making nodes, but this appears relatively complex.
Reviewers: spatel, RKSimon, craig.topper
Subscribers: jdoerfert, hiraditya, deadalnix, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57921
llvm-svn: 356382
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 43a1005d84a..4ff48732ef6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18934,14 +18934,13 @@ SDValue DAGCombiner::SimplifySelectCC(const SDLoc &DL, SDValue N0, SDValue N1, auto *N3C = dyn_cast<ConstantSDNode>(N3.getNode()); // Determine if the condition we're dealing with is constant. - SDValue SCC = SimplifySetCC(getSetCCResultType(CmpOpVT), N0, N1, CC, DL, - false); - if (SCC.getNode()) AddToWorklist(SCC.getNode()); - - if (auto *SCCC = dyn_cast_or_null<ConstantSDNode>(SCC.getNode())) { - // fold select_cc true, x, y -> x - // fold select_cc false, x, y -> y - return !SCCC->isNullValue() ? N2 : N3; + if (SDValue SCC = DAG.FoldSetCC(VT, N0, N1, CC, DL)) { + AddToWorklist(SCC.getNode()); + if (auto *SCCC = dyn_cast<ConstantSDNode>(SCC)) { + // fold select_cc true, x, y -> x + // fold select_cc false, x, y -> y + return !(SCCC->isNullValue()) ? N2 : N3; + } } if (SDValue V = |

