[llvm] 49ab760 - [DagCombine] Increase depth by number of operands to avoid a pathological compile time.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 13:35:19 PST 2022
Author: Alina Sbirlea
Date: 2022-02-09T13:31:28-08:00
New Revision: 49ab760090514dcbf84bd9dc7429146c4ca578ef
URL: https://github.com/llvm/llvm-project/commit/49ab760090514dcbf84bd9dc7429146c4ca578ef
DIFF: https://github.com/llvm/llvm-project/commit/49ab760090514dcbf84bd9dc7429146c4ca578ef.diff
LOG: [DagCombine] Increase depth by number of operands to avoid a pathological compile time.
We're hitting a pathological compile-time case, profiled to be in
DagCombiner::visitTokenFactor and many inserts into a SmallPtrSet.
It looks like one of the paths around findBetterNeighborChains is not
capped and leads to this.
This patch resolves the issue. Looking for feedback if this solution
looks reasonable.
Differential Revision: https://reviews.llvm.org/D118877
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8fd0001b4eb3f..954f30d4df4e7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -24037,7 +24037,7 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain,
}
for (unsigned n = Chain.getNumOperands(); n;)
Chains.push_back(Chain.getOperand(--n));
- ++Depth;
+ Depth += Chain.getNumOperands();
continue;
}
// Everything else
More information about the llvm-commits
mailing list