From 54d6a608bf81952fa042b101c31f58e8bfa9b1fd Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 16 Mar 2020 20:18:07 -0500 Subject: [PATCH] [Attributor][NFC] Predetermine the module It could happen that we delete the first function in the SCC in the future so we should be careful accessing `Functions` after the manifest stage. --- llvm/lib/Transforms/IPO/Attributor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 50071a2..0de59b3 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -8794,9 +8794,10 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache, A.identifyDefaultAbstractAttributes(*F); } + Module &M = *Functions.front()->getParent(); + (void)M; ChangeStatus Changed = A.run(); - assert(!verifyModule(*Functions.front()->getParent(), &errs()) && - "Module verification failed!"); + 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