[llvm] r353426 - [DAG] Cleanup unused node on failed SELECT Combine.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 7 08:57:50 PST 2019
Author: niravd
Date: Thu Feb 7 08:57:50 2019
New Revision: 353426
URL: http://llvm.org/viewvc/llvm-project?rev=353426&view=rev
Log:
[DAG] Cleanup unused node on failed SELECT Combine.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=353426&r1=353425&r2=353426&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb 7 08:57:50 2019
@@ -7444,6 +7444,9 @@ SDValue DAGCombiner::visitSELECT(SDNode
if (normalizeToSequence || !InnerSelect.use_empty())
return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0,
InnerSelect, N2);
+ // Cleanup on failure.
+ if (InnerSelect.use_empty())
+ recursivelyDeleteUnusedNodes(InnerSelect.getNode());
}
// select (or Cond0, Cond1), X, Y -> select Cond0, X, (select Cond1, X, Y)
if (N0->getOpcode() == ISD::OR && N0->hasOneUse()) {
@@ -7454,6 +7457,9 @@ SDValue DAGCombiner::visitSELECT(SDNode
if (normalizeToSequence || !InnerSelect.use_empty())
return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0, N1,
InnerSelect);
+ // Cleanup on failure.
+ if (InnerSelect.use_empty())
+ recursivelyDeleteUnusedNodes(InnerSelect.getNode());
}
// select Cond0, (select Cond1, X, Y), Y -> select (and Cond0, Cond1), X, Y
More information about the llvm-commits
mailing list