[llvm] [SimpleLoopUnswitch][NFC] move quadratic asserts under EXPENSIVE_CHECKS (PR #144887)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 00:55:06 PDT 2025


================
@@ -2522,12 +2522,14 @@ static void unswitchNontrivialInvariants(
   if (MSSAU && VerifyMemorySSA)
     MSSAU->getMemorySSA()->verifyMemorySSA();
 
+#ifdef EXPENSIVE_CHECKS
   // This transformation has a high risk of corrupting the dominator tree, and
   // the below steps to rebuild loop structures will result in hard to debug
   // errors in that case so verify that the dominator tree is sane first.
   // FIXME: Remove this when the bugs stop showing up and rely on existing
   // verification steps.
   assert(DT.verify(DominatorTree::VerificationLevel::Fast));
----------------
antoniofrighetto wrote:

I was suggesting leaving this check outside of EXPENSIVE_CHECKS. While no related issues seem to have come up recently (some of the recent bugs were unrelated to breaking the dominator tree), the pass still does rewrite loops, and in general the CFG, quite aggressively, so I'd rather keep the assert than dropping it. That said, maybe enabling it only under EXPENSIVE_CHECKS is okay...

> and to turn the one on line 3714/3717 to VerificationLevel::Full under expensive checks

Yeah I think now switching this one to VerificationLevel::Full under expensive checks could be reasonable.

https://github.com/llvm/llvm-project/pull/144887


More information about the llvm-commits mailing list