[llvm] r303181 - [DAG] Prune deleted nodes in TokenFactor

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 08:49:02 PDT 2017


Author: niravd
Date: Tue May 16 10:49:02 2017
New Revision: 303181

URL: http://llvm.org/viewvc/llvm-project?rev=303181&view=rev
Log:
[DAG] Prune deleted nodes in TokenFactor

Fix visitTokenFactor to correctly remove deleted nodes. NFC.

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=303181&r1=303180&r2=303181&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue May 16 10:49:02 2017
@@ -1729,10 +1729,9 @@ SDValue DAGCombiner::visitTokenFactor(SD
       NumLeftToConsider--;
   }
 
-  SDValue Result;
-
   // If we've changed things around then replace token factor.
   if (Changed) {
+    SDValue Result;
     if (Ops.empty()) {
       // The entry token is the only possible outcome.
       Result = DAG.getEntryNode();
@@ -1749,13 +1748,9 @@ SDValue DAGCombiner::visitTokenFactor(SD
         Result = DAG.getNode(ISD::TokenFactor, SDLoc(N), MVT::Other, Ops);
       }
     }
-
-    // Add users to worklist, since we may introduce a lot of new
-    // chained token factors while removing memory deps.
-    return CombineTo(N, Result, true /*add to worklist*/);
+    return Result;
   }
-
-  return Result;
+  return SDValue();
 }
 
 /// MERGE_VALUES can always be eliminated.




More information about the llvm-commits mailing list