diff options
author | Nirav Dave <niravd@google.com> | 2019-02-07 18:31:05 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2019-02-07 18:31:05 +0000 |
commit | 9332fc2e1919c74c1c3d4f4414e5a7771dc6eca4 (patch) | |
tree | 9e3da5db29b68e0ccd1e2e5b1787eea3f9d27d41 | |
parent | 981e63581a9a804ff6a2994b2d95193cd43d11f8 (diff) | |
download | bcm5719-llvm-9332fc2e1919c74c1c3d4f4414e5a7771dc6eca4.tar.gz bcm5719-llvm-9332fc2e1919c74c1c3d4f4414e5a7771dc6eca4.zip |
Revert "[DAG] Cleanup of unused node in SimplifySelectCC."
Causes ASAN use-after-poison errors.
llvm-svn: 353442
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index a3ad2c2f3ee..dabb8afd104 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -18673,21 +18673,14 @@ 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. - if (SDValue SCC = - SimplifySetCC(getSetCCResultType(CmpOpVT), N0, N1, CC, DL, false)) { - AddToWorklist(SCC.getNode()); - if (auto *SCCC = dyn_cast<ConstantSDNode>(SCC.getNode())) { - // fold select_cc true, x, y -> x - // fold select_cc false, x, y -> y - bool isNull = SCCC->isNullValue(); - SDValue RV = isNull ? N3 : N2; - // Delete SCC if we don't use it. - if (SCCC != RV.getNode()) - recursivelyDeleteUnusedNodes(SCCC); - return RV; - } - // Don't combine. Cleanup SCC. - recursivelyDeleteUnusedNodes(SCC.getNode()); + 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 V = |