summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-05-07 16:47:27 +0000
committerFlorian Hahn <flo@fhahn.com>2019-05-07 16:47:27 +0000
commita9d6c32eafc645c55b07eb50698c428e14c0bffd (patch)
treeb6b915cf382f4fcfbc9e289688e4b419a253f1ca
parent2a3d16feea3449f2c1bc1325a17a19e428185983 (diff)
downloadbcm5719-llvm-a9d6c32eafc645c55b07eb50698c428e14c0bffd.tar.gz
bcm5719-llvm-a9d6c32eafc645c55b07eb50698c428e14c0bffd.zip
[DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor
When simplifying TokenFactors, we potentially iterate over all operands of a large number of TokenFactors. This causes quadratic compile times in some cases and the large token factors cause additional scalability problems elsewhere. This patch adds some limits to the number of nodes explored for the cases mentioned above. Reviewers: niravd, spatel, craig.topper Reviewed By: niravd Differential Revision: https://reviews.llvm.org/D61397 llvm-svn: 360171
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c23469e166b..a98d151b443 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1792,8 +1792,9 @@ SDValue DAGCombiner::visitTokenFactor(SDNode *N) {
TFs.push_back(N);
// Iterate through token factors. The TFs grows when new token factors are
- // encountered.
- for (unsigned i = 0; i < TFs.size(); ++i) {
+ // encountered. Limit number of nodes to inline, to avoid quadratic compile
+ // times.
+ for (unsigned i = 0; i < TFs.size() && Ops.size() <= 2048; ++i) {
SDNode *TF = TFs[i];
// Check each of the operands.
OpenPOWER on IntegriCloud