From ad9c284cc3186f9ca603b1a99a0723b45a07ba09 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 13 Apr 2020 12:24:09 -0500 Subject: [PATCH] [Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS Running the verifier is expensive so we want to avoid it even in runs that enable assertions. As we move closer to enabling the Attributor this code will be executed by some buildbots but not cause overhead for most people. --- llvm/lib/Transforms/IPO/Attributor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 6475185..4cf2812 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -1248,6 +1248,14 @@ ChangeStatus Attributor::run() { "specified iterations!"); } +#ifdef EXPENSIVE_CHECKS + for (Function *F : Functions) { + if (ToBeDeletedFunctions.count(F)) + continue; + assert(!verifyFunction(*F, &errs()) && "Module verification failed!"); + } +#endif + return ManifestChange; } @@ -1982,10 +1990,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache, A.identifyDefaultAbstractAttributes(*F); } - Module &M = *Functions.front()->getParent(); - (void)M; ChangeStatus Changed = A.run(); - assert(!verifyModule(M, &errs()) && "Module verification failed!"); LLVM_DEBUG(dbgs() << "[Attributor] Done with " << Functions.size() << " functions, result: " << Changed << ".\n"); return Changed == ChangeStatus::CHANGED; -- 2.7.4