[llvm] [DAGCombiner] Limit steps in shouldCombineToPostInc (PR #116030)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 03:43:50 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag
Author: Jonathan Cohen (jcohen-apple)
<details>
<summary>Changes</summary>
Currently the function will walk the entire DAG to find other candidates to perform a post-inc store. This leads to very long compilation times on large functions. Added a MaxSteps limit to avoid this, which is also aligned to how hasPredecessorHelper is used elsewhere in the code.
---
Full diff: https://github.com/llvm/llvm-project/pull/116030.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+2-1)
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6059229cd6d9a4..cc51aed40003f0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -19089,7 +19089,8 @@ static bool shouldCombineToPostInc(SDNode *N, SDValue Ptr, SDNode *PtrUse,
IsMasked, OtherPtr, TLI)) {
SmallVector<const SDNode *, 2> Worklist;
Worklist.push_back(Use);
- if (SDNode::hasPredecessorHelper(N, Visited, Worklist))
+ constexpr unsigned int MaxSteps = 8192;
+ if (SDNode::hasPredecessorHelper(N, Visited, Worklist, MaxSteps))
return false;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/116030
More information about the llvm-commits
mailing list