diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index f57be39076a78..36d1b47973870 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -225,6 +225,9 @@ class AsmPrinter : public MachineFunctionPass { /// split stack prologue. bool HasNoSplitStack = false; + /// True if debugging information is available in this module. + bool DbgInfoAvailable = false; + protected: explicit AsmPrinter(TargetMachine &TM, std::unique_ptr Streamer); @@ -430,6 +433,9 @@ class AsmPrinter : public MachineFunctionPass { /// Get the CFISection type for the module. CFISection getModuleCFISectionType() const { return ModuleCFISection; } + /// Returns true if valid debug info is present. + bool hasDebugInfo() const { return DbgInfoAvailable; } + bool needsSEHMoves(); /// Since emitting CFI unwind information is entangled with supporting the diff --git a/llvm/include/llvm/CodeGen/MIRPrinter.h b/llvm/include/llvm/CodeGen/MIRPrinter.h index e98ef72243b8d..85bd674c56a60 100644 --- a/llvm/include/llvm/CodeGen/MIRPrinter.h +++ b/llvm/include/llvm/CodeGen/MIRPrinter.h @@ -21,6 +21,7 @@ namespace llvm { class MachineBasicBlock; class MachineFunction; +class MachineModuleInfo; class Module; template class SmallVectorImpl; diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h index 6e7292abeddbb..e1d03fe6b92c1 100644 --- a/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/llvm/include/llvm/CodeGen/MachineFunction.h @@ -59,7 +59,6 @@ class MachineConstantPool; class MachineFrameInfo; class MachineFunction; class MachineJumpTableInfo; -class MachineModuleInfo; class MachineRegisterInfo; class MCContext; class MCInstrDesc; @@ -260,7 +259,6 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { const LLVMTargetMachine &Target; const TargetSubtargetInfo *STI; MCContext &Ctx; - MachineModuleInfo &MMI; // RegInfo - Information about each register in use in the function. MachineRegisterInfo *RegInfo; @@ -395,15 +393,15 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { /// \} - /// Clear all the members of this MachineFunction, but the ones used - /// to initialize again the MachineFunction. - /// More specifically, this deallocates all the dynamically allocated - /// objects and get rid of all the XXXInfo data structure, but keep - /// unchanged the references to Fn, Target, MMI, and FunctionNumber. + /// Clear all the members of this MachineFunction, but the ones used to + /// initialize again the MachineFunction. More specifically, this deallocates + /// all the dynamically allocated objects and get rids of all the XXXInfo data + /// structure, but keeps unchanged the references to Fn, Target, and + /// FunctionNumber. void clear(); /// Allocate and initialize the different members. /// In particular, the XXXInfo data structure. - /// \pre Fn, Target, MMI, and FunctionNumber are properly set. + /// \pre Fn, Target, and FunctionNumber are properly set. void init(); public: @@ -632,8 +630,8 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { const static unsigned int DebugOperandMemNumber; MachineFunction(Function &F, const LLVMTargetMachine &Target, - const TargetSubtargetInfo &STI, unsigned FunctionNum, - MachineModuleInfo &MMI); + const TargetSubtargetInfo &STI, MCContext &Ctx, + unsigned FunctionNum); MachineFunction(const MachineFunction &) = delete; MachineFunction &operator=(const MachineFunction &) = delete; ~MachineFunction(); @@ -665,7 +663,6 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { GISelChangeObserver *getObserver() const { return Observer; } - MachineModuleInfo &getMMI() const { return MMI; } MCContext &getContext() const { return Ctx; } /// Returns the Section this function belongs to. diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h index f054c56bb641c..310cc4b2abb77 100644 --- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h +++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h @@ -99,9 +99,6 @@ class MachineModuleInfo { /// want. MachineModuleInfoImpl *ObjFileMMI; - /// True if debugging information is available in this module. - bool DbgInfoAvailable = false; - /// Maps IR Functions to their corresponding MachineFunctions. DenseMap> MachineFunctions; /// Next unique number available for a MachineFunction. @@ -168,9 +165,6 @@ class MachineModuleInfo { return const_cast(this)->getObjFileInfo(); } - /// Returns true if valid debug info is present. - bool hasDebugInfo() const { return DbgInfoAvailable; } - /// \} }; // End class MachineModuleInfo diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index 24eab7b408675..6a80c8c7216f6 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -76,6 +76,7 @@ struct KnownBits; class LLVMContext; class MachineBasicBlock; class MachineConstantPoolValue; +class MachineModuleInfo; class MCSymbol; class OptimizationRemarkEmitter; class ProfileSummaryInfo; diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h index 54f71c9d221ad..882cadea22369 100644 --- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -46,6 +46,7 @@ class LiveIntervals; class LiveVariables; class MachineLoop; class MachineMemOperand; +class MachineModuleInfo; class MachineRegisterInfo; class MCAsmInfo; class MCInst; diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 2297b27ffdc07..4e35664e7458d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -436,6 +436,7 @@ bool AsmPrinter::doInitialization(Module &M) { MMI = MMIWP ? &MMIWP->getMMI() : nullptr; HasSplitStack = false; HasNoSplitStack = false; + DbgInfoAvailable = !M.debug_compile_units().empty(); AddrLabelSymbols = nullptr; @@ -541,8 +542,7 @@ bool AsmPrinter::doInitialization(Module &M) { if (EmitCodeView && TM.getTargetTriple().isOSWindows()) DebugHandlers.push_back(std::make_unique(this)); if (!EmitCodeView || M.getDwarfVersion()) { - assert(MMI && "MMI could not be nullptr here!"); - if (MMI->hasDebugInfo()) { + if (hasDebugInfo()) { DD = new DwarfDebug(this); DebugHandlers.push_back(std::unique_ptr(DD)); } @@ -1277,8 +1277,7 @@ AsmPrinter::getFunctionCFISectionType(const Function &F) const { if (MAI->usesCFIWithoutEH() && F.hasUWTable()) return CFISection::EH; - assert(MMI != nullptr && "Invalid machine module info"); - if (MMI->hasDebugInfo() || TM.Options.ForceDwarfFrameSection) + if (hasDebugInfo() || TM.Options.ForceDwarfFrameSection) return CFISection::Debug; return CFISection::None; @@ -1669,10 +1668,9 @@ void AsmPrinter::emitPCSections(const MachineFunction &MF) { } /// Returns true if function begin and end labels should be emitted. -static bool needFuncLabels(const MachineFunction &MF, - const MachineModuleInfo &MMI) { - if (!MF.getLandingPads().empty() || MF.hasEHFunclets() || - MMI.hasDebugInfo() || +static bool needFuncLabels(const MachineFunction &MF, const AsmPrinter &Asm) { + if (Asm.hasDebugInfo() || !MF.getLandingPads().empty() || + MF.hasEHFunclets() || MF.getFunction().hasMetadata(LLVMContext::MD_pcsections)) return true; @@ -1944,7 +1942,7 @@ void AsmPrinter::emitFunctionBody() { // are automatically sized. bool EmitFunctionSize = MAI->hasDotTypeDotSizeDirective() && !TT.isWasm(); - if (needFuncLabels(*MF, *MMI) || EmitFunctionSize) { + if (EmitFunctionSize || needFuncLabels(*MF, *this)) { // Create a symbol for the end of function. CurrentFnEnd = createTempSymbol("func_end"); OutStreamer->emitLabel(CurrentFnEnd); @@ -2588,7 +2586,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { if (F.hasFnAttribute("patchable-function-entry") || F.hasFnAttribute("function-instrument") || F.hasFnAttribute("xray-instruction-threshold") || - needFuncLabels(MF, *MMI) || NeedsLocalForSize || + needFuncLabels(MF, *this) || NeedsLocalForSize || MF.getTarget().Options.EmitStackSizeSection || MF.getTarget().Options.BBAddrMap || MF.hasBBLabels()) { CurrentFnBegin = createTempSymbol("func_begin"); diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index dddc08b3bc016..7700ffd6da803 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -613,7 +613,7 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) { void CodeViewDebug::beginModule(Module *M) { // If module doesn't have named metadata anchors or COFF debug section // is not available, skip any debug info related stuff. - if (!MMI->hasDebugInfo() || + if (!Asm->hasDebugInfo() || !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) { Asm = nullptr; return; @@ -636,7 +636,7 @@ void CodeViewDebug::beginModule(Module *M) { } void CodeViewDebug::endModule() { - if (!Asm || !MMI->hasDebugInfo()) + if (!Asm || !Asm->hasDebugInfo()) return; // The COFF .debug$S section consists of several subsections, each starting diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index ed99eb3c459e5..de2263c57493b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -351,7 +351,7 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) { } void DebugHandlerBase::beginInstruction(const MachineInstr *MI) { - if (!Asm || !MMI->hasDebugInfo()) + if (!Asm || !Asm->hasDebugInfo()) return; assert(CurMI == nullptr); @@ -377,7 +377,7 @@ void DebugHandlerBase::beginInstruction(const MachineInstr *MI) { } void DebugHandlerBase::endInstruction() { - if (!Asm || !MMI->hasDebugInfo()) + if (!Asm || !Asm->hasDebugInfo()) return; assert(CurMI != nullptr); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index fbce7e92b7781..ac4d0f21de60b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1434,7 +1434,7 @@ void DwarfDebug::endModule() { // If we aren't actually generating debug info (check beginModule - // conditionalized on the presence of the llvm.dbg.cu metadata node) - if (!Asm || !MMI->hasDebugInfo()) + if (!Asm || !Asm->hasDebugInfo()) return; // Finalize the debug info for the module. diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 61799251095ae..40bde200f37ac 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -162,9 +162,9 @@ static inline Align getFnStackAlignment(const TargetSubtargetInfo *STI, } MachineFunction::MachineFunction(Function &F, const LLVMTargetMachine &Target, - const TargetSubtargetInfo &STI, - unsigned FunctionNum, MachineModuleInfo &mmi) - : F(F), Target(Target), STI(&STI), Ctx(mmi.getContext()), MMI(mmi) { + const TargetSubtargetInfo &STI, MCContext &Ctx, + unsigned FunctionNum) + : F(F), Target(Target), STI(&STI), Ctx(Ctx) { FunctionNumber = FunctionNum; init(); } @@ -659,9 +659,9 @@ bool MachineFunction::needsFrameMoves() const { // under this switch, we'd like .debug_frame to be precise when using -g. At // this moment, there's no way to specify that some CFI directives go into // .eh_frame only, while others go into .debug_frame only. - return getMMI().hasDebugInfo() || - getTarget().Options.ForceDwarfFrameSection || - F.needsUnwindTableEntry(); + return getTarget().Options.ForceDwarfFrameSection || + F.needsUnwindTableEntry() || + !F.getParent()->debug_compile_units().empty(); } namespace llvm { diff --git a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp index 24eb360723dad..e7a4d6d61e211 100644 --- a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp +++ b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp @@ -37,7 +37,7 @@ MachineFunctionAnalysis::run(Function &F, FunctionAnalysisManager &FAM) { .getCachedResult(*F.getParent()) ->getMMI(); auto MF = std::make_unique( - F, *TM, STI, Context.generateMachineFunctionNum(F), MMI); + F, *TM, STI, MMI.getContext(), Context.generateMachineFunctionNum(F)); MF->initTargetMachineFunctionInfo(STI); // MRI callback for target specific initializations. diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index f382df1d2a6e0..c66495969b4e6 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -27,7 +27,6 @@ MachineModuleInfoImpl::~MachineModuleInfoImpl() = default; void MachineModuleInfo::initialize() { ObjFileMMI = nullptr; NextFnNum = 0; - DbgInfoAvailable = false; } void MachineModuleInfo::finalize() { @@ -87,7 +86,7 @@ MachineFunction &MachineModuleInfo::getOrCreateMachineFunction(Function &F) { if (I.second) { // No pre-existing machine function, create a new one. const TargetSubtargetInfo &STI = *TM.getSubtargetImpl(F); - MF = new MachineFunction(F, TM, STI, NextFnNum++, *this); + MF = new MachineFunction(F, TM, STI, getContext(), NextFnNum++); MF->initTargetMachineFunctionInfo(STI); // MRI callback for target specific initializations. @@ -207,7 +206,6 @@ bool MachineModuleInfoWrapperPass::doInitialization(Module &M) { Ctx.diagnose( DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, LocCookie)); }); - MMI.DbgInfoAvailable = !M.debug_compile_units().empty(); return false; } @@ -232,6 +230,5 @@ MachineModuleAnalysis::run(Module &M, ModuleAnalysisManager &) { Ctx.diagnose( DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, LocCookie)); }); - MMI.DbgInfoAvailable = !M.debug_compile_units().empty(); return Result(MMI); } diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index b4eba07afe7c5..d7197a7923eaf 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -928,8 +928,6 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O, } bool NVPTXAsmPrinter::doFinalization(Module &M) { - bool HasDebugInfo = MMI && MMI->hasDebugInfo(); - // If we did not emit any functions, then the global declarations have not // yet been emitted. if (!GlobalsEmitted) { @@ -945,7 +943,7 @@ bool NVPTXAsmPrinter::doFinalization(Module &M) { auto *TS = static_cast(OutStreamer->getTargetStreamer()); // Close the last emitted section - if (HasDebugInfo) { + if (hasDebugInfo()) { TS->closeLastSection(); // Emit empty .debug_loc section for better support of the empty files. OutStreamer->emitRawText("\t.section\t.debug_loc\t{\t}"); diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 0e2811f87c817..dcde86388dcd9 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -3137,11 +3137,11 @@ void PPCAIXAsmPrinter::emitInstruction(const MachineInstr *MI) { break; MCSymbol *TempSym = OutContext.createNamedTempSymbol(); OutStreamer->emitLabel(TempSym); - OutStreamer->emitXCOFFExceptDirective(CurrentFnSym, TempSym, - LangMO.getImm(), ReasonMO.getImm(), - Subtarget->isPPC64() ? MI->getMF()->getInstructionCount() * 8 : - MI->getMF()->getInstructionCount() * 4, - MMI->hasDebugInfo()); + OutStreamer->emitXCOFFExceptDirective( + CurrentFnSym, TempSym, LangMO.getImm(), ReasonMO.getImm(), + Subtarget->isPPC64() ? MI->getMF()->getInstructionCount() * 8 + : MI->getMF()->getInstructionCount() * 4, + hasDebugInfo()); break; } case PPC::GETtlsMOD32AIX: @@ -3199,7 +3199,7 @@ void PPCAIXAsmPrinter::emitInstruction(const MachineInstr *MI) { bool PPCAIXAsmPrinter::doFinalization(Module &M) { // Do streamer related finalization for DWARF. - if (!MAI->usesDwarfFileAndLocDirectives() && MMI->hasDebugInfo()) + if (!MAI->usesDwarfFileAndLocDirectives() && hasDebugInfo()) OutStreamer->doFinalizationAtSectionEnd( OutStreamer->getContext().getObjectFileInfo()->getTextSection()); diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp index 629996d74194e..3d36d80f82315 100644 --- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp +++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp @@ -232,7 +232,7 @@ static std::unique_ptr cloneMF(MachineFunction *SrcMF, MachineModuleInfo &DestMMI) { auto DstMF = std::make_unique( SrcMF->getFunction(), SrcMF->getTarget(), SrcMF->getSubtarget(), - SrcMF->getFunctionNumber(), DestMMI); + SrcMF->getContext(), SrcMF->getFunctionNumber()); DenseMap Src2DstMBB; auto *SrcMRI = &SrcMF->getRegInfo(); diff --git a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp index 877793a28b769..79e27c7ced61f 100644 --- a/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp +++ b/llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp @@ -61,8 +61,8 @@ class AArch64SelectionDAGTest : public testing::Test { MachineModuleInfo MMI(TM.get()); - MF = std::make_unique(*F, *TM, *TM->getSubtargetImpl(*F), 0, - MMI); + MF = std::make_unique(*F, *TM, *TM->getSubtargetImpl(*F), + MMI.getContext(), 0); DAG = std::make_unique(*TM, CodeGenOptLevel::None); if (!DAG) diff --git a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp index 28cfb3046bd47..d5365d9c79492 100644 --- a/llvm/unittests/CodeGen/InstrRefLDVTest.cpp +++ b/llvm/unittests/CodeGen/InstrRefLDVTest.cpp @@ -94,7 +94,7 @@ class InstrRefLDVTest : public testing::Test { const TargetSubtargetInfo &STI = *Machine->getSubtargetImpl(*F); MF = std::make_unique(*F, (LLVMTargetMachine &)*Machine, - STI, FunctionNum, *MMI); + STI, MMI->getContext(), FunctionNum); // Create metadata: CU, subprogram, some blocks and an inline function // scope. diff --git a/llvm/unittests/CodeGen/MFCommon.inc b/llvm/unittests/CodeGen/MFCommon.inc index 1997e80522975..d464a16f636cf 100644 --- a/llvm/unittests/CodeGen/MFCommon.inc +++ b/llvm/unittests/CodeGen/MFCommon.inc @@ -135,6 +135,7 @@ std::unique_ptr createMachineFunction(LLVMContext &Ctx, MachineModuleInfo MMI(TM); const TargetSubtargetInfo &STI = *TM->getSubtargetImpl(*F); - return std::make_unique(*F, *TM, STI, FunctionNum, MMI); + return std::make_unique(*F, *TM, STI, MMI.getContext(), + FunctionNum); } diff --git a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp index ef30bd491d352..c89e5a45ab014 100644 --- a/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp +++ b/llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp @@ -72,7 +72,7 @@ class SelectionDAGAddressAnalysisTest : public testing::Test { MachineModuleInfo MMI(TM.get()); MF = std::make_unique(*F, *TM, *TM->getSubtargetImpl(*F), - 0, MMI); + MMI.getContext(), 0); DAG = std::make_unique(*TM, CodeGenOptLevel::None); if (!DAG) diff --git a/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp b/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp index e318f467bbf27..eadb0e26ba3b2 100644 --- a/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp +++ b/llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp @@ -71,7 +71,7 @@ class SelectionDAGPatternMatchTest : public testing::Test { MachineModuleInfo MMI(TM.get()); MF = std::make_unique(*F, *TM, *TM->getSubtargetImpl(*F), - 0, MMI); + MMI.getContext(), 0); DAG = std::make_unique(*TM, CodeGenOptLevel::None); if (!DAG) diff --git a/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp b/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp index ece288aaf06a0..5ac4edae5f0df 100644 --- a/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp +++ b/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp @@ -29,7 +29,8 @@ TEST(AMDGPU, ExecMayBeModifiedBeforeAnyUse) { auto *F = Function::Create(Type, GlobalValue::ExternalLinkage, "Test", &Mod); MachineModuleInfo MMI(TM.get()); - auto MF = std::make_unique(*F, *TM, ST, 42, MMI); + auto MF = + std::make_unique(*F, *TM, ST, MMI.getContext(), 42); auto *BB = MF->CreateMachineBasicBlock(); MF->push_back(BB); diff --git a/llvm/unittests/Target/AMDGPU/PALMetadata.cpp b/llvm/unittests/Target/AMDGPU/PALMetadata.cpp index 7d4f3836088ab..86aa4753a2123 100644 --- a/llvm/unittests/Target/AMDGPU/PALMetadata.cpp +++ b/llvm/unittests/Target/AMDGPU/PALMetadata.cpp @@ -62,7 +62,7 @@ class PALMetadata : public testing::Test { TM->getTargetCPU(), TM->getTargetFeatureString(), *TM); - MF = std::make_unique(*F, *TM, *ST, 1, *MMI); + MF = std::make_unique(*F, *TM, *ST, MMI->getContext(), 1); } }; diff --git a/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp b/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp index 62cfda435a047..fe711619c6320 100644 --- a/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp +++ b/llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp @@ -63,7 +63,7 @@ class RISCVInstrInfoTest : public testing::TestWithParam { TM->getTargetFeatureString(), TM->getTargetTriple().isArch64Bit() ? "lp64" : "ilp32", 0, 0, *TM); - MF = std::make_unique(*F, *TM, *ST, 42, *MMI); + MF = std::make_unique(*F, *TM, *ST, MMI->getContext(), 42); } };