[llvm] r324797 - [DAG] Make early exit hasPredecessorHelper return true. NFCI.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 9 18:41:23 PST 2018
Author: niravd
Date: Fri Feb 9 18:41:22 2018
New Revision: 324797
URL: http://llvm.org/viewvc/llvm-project?rev=324797&view=rev
Log:
[DAG] Make early exit hasPredecessorHelper return true. NFCI.
All uses conservatively assume in early exit case that it will be a
predecessor. Changing default removes checking code in all uses.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=324797&r1=324796&r2=324797&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Feb 9 18:41:22 2018
@@ -842,6 +842,9 @@ public:
}
// Push deferred nodes back on worklist.
Worklist.append(DeferredNodes.begin(), DeferredNodes.end());
+ // If we bailed early, conservatively return found.
+ if (MaxSteps != 0 && Visited.size() >= MaxSteps)
+ return true;
return Found;
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=324797&r1=324796&r2=324797&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Feb 9 18:41:22 2018
@@ -2430,9 +2430,6 @@ HandleMergeInputChains(SmallVectorImpl<S
for (auto *N : ChainNodesMatched)
if (SDNode::hasPredecessorHelper(N, Visited, Worklist, Max, true))
return SDValue();
- // Fail conservatively if we stopped searching early.
- if (Visited.size() >= Max)
- return SDValue();
// Return merged chain.
if (InputChains.size() == 1)
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=324797&r1=324796&r2=324797&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 9 18:41:22 2018
@@ -2117,10 +2117,10 @@ static bool isFusableLoadOpStorePattern(
// this search by visiting the uses and make sure they all have
// smaller node id than the load.
- bool FoundLoad = false;
- SmallVector<SDValue, 4> ChainOps;
- SmallVector<const SDNode *, 4> LoopWorklist;
- SmallPtrSet<const SDNode *, 16> Visited;
+ bool FoundLoad = false;
+ SmallVector<SDValue, 4> ChainOps;
+ SmallVector<const SDNode *, 4> LoopWorklist;
+ SmallPtrSet<const SDNode *, 16> Visited;
for (unsigned i = 0, e = Chain.getNumOperands(); i != e; ++i) {
SDValue Op = Chain.getOperand(i);
if (Op == Load.getValue(1)) {
@@ -2144,9 +2144,6 @@ static bool isFusableLoadOpStorePattern(
if (SDNode::hasPredecessorHelper(Load.getNode(), Visited, LoopWorklist,
Max, true))
return false;
- // Fail conservatively if we ended loop search early.
- if (Visited.size() >= Max)
- return false;
}
// Make a new TokenFactor with all the other input chains except
More information about the llvm-commits
mailing list