Revert "[DAG] Cleanup of unused node in SimplifySelectCC."

Causes ASAN use-after-poison errors.

llvm-svn: 353442
This commit is contained in:
Nirav Dave 2019-02-07 18:31:05 +00:00
parent 981e63581a
commit 9332fc2e19
1 changed files with 8 additions and 15 deletions

View File

@ -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 =