[llvm] r213505 - [SDAG] Rather than using a narrow test against the one dummy node on the

Chandler Carruth chandlerc at gmail.com
Mon Jul 21 01:32:31 PDT 2014

Author: chandlerc
Date: Mon Jul 21 03:32:31 2014
New Revision: 213505

URL: http://llvm.org/viewvc/llvm-project?rev=213505&view=rev
[SDAG] Rather than using a narrow test against the one dummy node on the
stack, filter all handle nodes from the DAG combiner worklist.

This will also handle cases where other handle nodes might be
(erroneously) added to the worklist and then cause bugs and explosions
when deleted. For example, when running the legalizer within the DAG
combiner, there are times when other handle nodes are used and can end
up here.


Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=213505&r1=213504&r2=213505&view=diff
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jul 21 03:32:31 2014
@@ -127,6 +127,11 @@ namespace {
     /// AddToWorkList - Add to the work list making sure its instance is at the
     /// back (next to be processed.)
     void AddToWorkList(SDNode *N) {
+      // Skip handle nodes as they can't usefully be combined and confuse the
+      // zero-use deletion strategy.
+      if (N->getOpcode() == ISD::HANDLENODE)
+        return;
@@ -1108,7 +1113,7 @@ void DAGCombiner::Run(CombineLevel AtLev
     // If N has no uses, it is dead.  Make sure to revisit all N's operands once
     // N is deleted from the DAG, since they too may now be dead or may have a
     // reduced number of uses, allowing other xforms.
-    if (N->use_empty() && N != &Dummy) {
+    if (N->use_empty()) {
       for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)

More information about the llvm-commits mailing list