[llvm] r324491 - [SelectionDAG] More Aggressibly prune nodes in AddChains. NFCI.

Nirav Dave via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 09:12:34 PST 2018


Author: niravd
Date: Wed Feb  7 09:12:34 2018
New Revision: 324491

URL: http://llvm.org/viewvc/llvm-project?rev=324491&view=rev
Log:
[SelectionDAG] More Aggressibly prune nodes in AddChains. NFCI.

Travel all chains paths to first non-tokenfactor node can be
exponential work. Add simple redundency check to avoid this.
Fixes PR36264.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=324491&r1=324490&r2=324491&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb  7 09:12:34 2018
@@ -2396,13 +2396,15 @@ HandleMergeInputChains(SmallVectorImpl<S
       return;
     if (V->getOpcode() == ISD::EntryToken)
       return;
+    if (!Visited.insert(V.getNode()).second)
+      return;
     // Newly selected nodes (-1) are always added directly.
     if (V->getNodeId() == -1)
       InputChains.push_back(V);
     else if (V->getOpcode() == ISD::TokenFactor) {
       for (int i = 0, e = V->getNumOperands(); i != e; ++i)
         AddChains(V->getOperand(i));
-    } else if (!Visited.count(V.getNode()))
+    } else
       InputChains.push_back(V);
   };
 




More information about the llvm-commits mailing list