[llvm-branch-commits] [llvm] 98cd1c3 - [NFC][SimplifyCFG] Hoist 'original' DomTree verification from simplifyOnce() into run()

Roman Lebedev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jan 3 14:07:18 PST 2021


Author: Roman Lebedev
Date: 2021-01-04T01:02:02+03:00
New Revision: 98cd1c33e3c2c3cfee36fb0fea3285fda06224d3

URL: https://github.com/llvm/llvm-project/commit/98cd1c33e3c2c3cfee36fb0fea3285fda06224d3
DIFF: https://github.com/llvm/llvm-project/commit/98cd1c33e3c2c3cfee36fb0fea3285fda06224d3.diff

LOG: [NFC][SimplifyCFG] Hoist 'original' DomTree verification from simplifyOnce() into run()

This is NFC since SimplifyCFG still currently defaults to not preserving DomTree.

SimplifyCFGOpt::simplifyOnce() is only be called from SimplifyCFGOpt::run(),
and can not be called externally, since SimplifyCFGOpt is defined in .cpp
This avoids some needless verifications, and is thus a bit faster
without sacrificing precision.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index f02ff2252f7d..a4faf22b8294 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6675,11 +6675,6 @@ bool SimplifyCFGOpt::simplifyOnceImpl(BasicBlock *BB) {
 }
 
 bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
-  assert((!RequireAndPreserveDomTree ||
-          (DTU &&
-           DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full))) &&
-         "Original domtree is invalid?");
-
   bool Changed = simplifyOnceImpl(BB);
 
   assert((!RequireAndPreserveDomTree ||
@@ -6691,6 +6686,11 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
 }
 
 bool SimplifyCFGOpt::run(BasicBlock *BB) {
+  assert((!RequireAndPreserveDomTree ||
+          (DTU &&
+           DTU->getDomTree().verify(DominatorTree::VerificationLevel::Full))) &&
+         "Original domtree is invalid?");
+
   bool Changed = false;
 
   // Repeated simplify BB as long as resimplification is requested.


        


More information about the llvm-branch-commits mailing list