[llvm-branch-commits] [CodeGen] Limit number of analyzed predecessors (PR #142584)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 3 18:51:17 PDT 2025
================
@@ -1030,6 +1036,11 @@ bool MachineBlockPlacement::isTrellis(
SmallPtrSet<const MachineBasicBlock *, 8> SeenPreds;
for (MachineBasicBlock *Succ : ViableSuccs) {
+ // Compile-time optimization: runtime is quadratic in the number of
+ // predecessors. For such uncommon cases, exit early.
+ if (Succ->pred_size() > PredecessorLimit)
----------------
spupyrev wrote:
Just to confirm I understand correctly: you have an example of (generated) IR where the runtime is large without the diff and is much smaller with the proposed change?
(I'm not familiar with this function but I don't see where quadratic complexity is.)
https://github.com/llvm/llvm-project/pull/142584
More information about the llvm-branch-commits
mailing list