From c9157d925c489f07ba9c0b2ce47e5149b75969a5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2023 21:30:12 +0100 Subject: Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb. PR: 276104 MFC after: 1 month (cherry picked from commit 5f757f3ff9144b609b3c433dfd370cc6bdc191ad) --- .../llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp') diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp index 439ff8babcc6..914e6b19fde9 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachinePassManager.cpp @@ -33,16 +33,17 @@ Error MachineFunctionPassManager::run(Module &M, (void)RequireCodeGenSCCOrder; assert(!RequireCodeGenSCCOrder && "not implemented"); + // M is unused here + PassInstrumentation PI = MFAM.getResult(M); + // Add a PIC to verify machine functions. if (VerifyMachineFunction) { - PassInstrumentation PI = MFAM.getResult(M); - // No need to pop this callback later since MIR pipeline is flat which means // current pipeline is the top-level pipeline. Callbacks are not used after // current pipeline. PI.pushBeforeNonSkippedPassCallback([&MFAM](StringRef PassID, Any IR) { - assert(any_cast(&IR)); - const MachineFunction *MF = any_cast(IR); + assert(llvm::any_cast(&IR)); + const MachineFunction *MF = llvm::any_cast(IR); assert(MF && "Machine function should be valid for printing"); std::string Banner = std::string("After ") + std::string(PassID); verifyMachineFunction(&MFAM, Banner, *MF); @@ -59,8 +60,11 @@ Error MachineFunctionPassManager::run(Module &M, do { // Run machine module passes for (; MachineModulePasses.count(Idx) && Idx != Size; ++Idx) { + if (!PI.runBeforePass(*Passes[Idx], M)) + continue; if (auto Err = MachineModulePasses.at(Idx)(M, MFAM)) return Err; + PI.runAfterPass(*Passes[Idx], M, PreservedAnalyses::all()); } // Finish running all passes. @@ -81,7 +85,6 @@ Error MachineFunctionPassManager::run(Module &M, continue; MachineFunction &MF = MMI.getOrCreateMachineFunction(F); - PassInstrumentation PI = MFAM.getResult(MF); for (unsigned I = Begin, E = Idx; I != E; ++I) { auto *P = Passes[I].get(); -- cgit v1.2.3