From 98cd1c33e3c2c3cfee36fb0fea3285fda06224d3 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Sun, 3 Jan 2021 21:53:11 +0300 Subject: [PATCH] [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. --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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.