[PATCH] D54732: [LoopUnroll] Don't verify domtree by default with +Asserts.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 15:38:58 PST 2018


efriedma created this revision.
efriedma added reviewers: davide, dmgreen, kuhar, NutshellySima.
Herald added a subscriber: zzheng.

domtree verification is linear in the size of the function, so it can cause a quadratic compile-time explosion in a function with many loops to unroll.


Repository:
  rL LLVM

https://reviews.llvm.org/D54732

Files:
  lib/Transforms/Utils/LoopUnroll.cpp
  lib/Transforms/Utils/LoopUnrollPeel.cpp


Index: lib/Transforms/Utils/LoopUnrollPeel.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -615,7 +615,9 @@
       // the original loop body.
       if (Iter == 0)
         DT->changeImmediateDominator(Exit, cast<BasicBlock>(LVMap[Latch]));
+#ifdef EXPENSIVE_CHECKS
       assert(DT->verify(DominatorTree::VerificationLevel::Fast));
+#endif
     }
 
     auto *LatchBRCopy = cast<BranchInst>(VMap[LatchBR]);
Index: lib/Transforms/Utils/LoopUnroll.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnroll.cpp
+++ lib/Transforms/Utils/LoopUnroll.cpp
@@ -54,10 +54,10 @@
 static cl::opt<bool>
 UnrollVerifyDomtree("unroll-verify-domtree", cl::Hidden,
                     cl::desc("Verify domtree after unrolling"),
-#ifdef NDEBUG
-    cl::init(false)
-#else
+#ifdef EXPENSIVE_CHECKS
     cl::init(true)
+#else
+    cl::init(false)
 #endif
                     );
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54732.174699.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/ce71b185/attachment.bin>


More information about the llvm-commits mailing list