[llvm] [SimplifyCFG] Increase iterative simplification convergence limit. (PR #178406)

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 03:52:49 PST 2026


https://github.com/maarquitos14 created https://github.com/llvm/llvm-project/pull/178406

https://github.com/llvm/llvm-project/commit/a9b0776a81e84d8042716863842fe1f8adf39cad added an assertion to avoid infinite loops. However, the limit seems arbitrary, there is no justification for it neither in the code nor in the commit message, so I think this can be increased.

>From 6ee018e08a4358ab393a2967a524623ef60e7ae6 Mon Sep 17 00:00:00 2001
From: Marcos Maronas <mmaronas at amd.com>
Date: Wed, 28 Jan 2026 05:46:28 -0600
Subject: [PATCH] Increase iterative simplification convergence limit.

---
 llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 7ffccf73bd39d..edcdaea4c31da 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -244,7 +244,7 @@ static bool iterativelySimplifyCFG(Function &F, const TargetTransformInfo &TTI,
   unsigned IterCnt = 0;
   (void)IterCnt;
   while (LocalChange) {
-    assert(IterCnt++ < 1000 && "Iterative simplification didn't converge!");
+    assert(IterCnt++ < 2000 && "Iterative simplification didn't converge!");
     LocalChange = false;
 
     // Loop over all of the basic blocks and remove them if they are unneeded.



More information about the llvm-commits mailing list