[llvm] 1a25133 - [DAGCombine] Skip re-visiting EntryToken to avoid compile time explosion
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 10:14:11 PDT 2020
Author: Ulrich Weigand
Date: 2020-09-09T19:13:46+02:00
New Revision: 1a25133bcdfeb525168ed4bd7e747463e635d0a4
URL: https://github.com/llvm/llvm-project/commit/1a25133bcdfeb525168ed4bd7e747463e635d0a4
DIFF: https://github.com/llvm/llvm-project/commit/1a25133bcdfeb525168ed4bd7e747463e635d0a4.diff
LOG: [DAGCombine] Skip re-visiting EntryToken to avoid compile time explosion
During the main DAGCombine loop, whenever a node gets replaced, the new
node and all its users are pushed onto the worklist. Omit this if the
new node is the EntryToken (e.g. if a store managed to get optimized
out), because re-visiting the EntryToken and its users will not uncover
any additional opportunities, but there may be a large number of such
users, potentially causing compile time explosion.
This compile time explosion showed up in particular when building the
SingleSource/UnitTests/matrix-types-spec.cpp test-suite case on any
platform without SIMD vector support.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D86963
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 e5c5e5341a68..c714358c0157 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1558,9 +1558,15 @@ void DAGCombiner::Run(CombineLevel AtLevel) {
DAG.ReplaceAllUsesWith(N, &RV);
}
- // Push the new node and any users onto the worklist
- AddToWorklist(RV.getNode());
- AddUsersToWorklist(RV.getNode());
+ // Push the new node and any users onto the worklist. Omit this if the
+ // new node is the EntryToken (e.g. if a store managed to get optimized
+ // out), because re-visiting the EntryToken and its users will not uncover
+ // any additional opportunities, but there may be a large number of such
+ // users, potentially causing compile time explosion.
+ if (RV.getOpcode() != ISD::EntryToken) {
+ AddToWorklist(RV.getNode());
+ AddUsersToWorklist(RV.getNode());
+ }
// Finally, if the node is now dead, remove it from the graph. The node
// may not be dead if the replacement process recursively simplified to
More information about the llvm-commits
mailing list