[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 08:59:24 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 93eda08babe95188ee41400035abaade79cda7d1 923978640a76a33d77ab2c794953479efa86b73c --extensions h,cpp,inc -- clang/lib/CodeGen/BackendUtil.cpp clang/lib/Interpreter/DeviceOffload.cpp clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp llvm/include/llvm/CodeGen/MachineModuleInfo.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/MachineModuleInfo.cpp llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp llvm/lib/ExecutionEngine/MCJIT/MCJIT.h llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp llvm/lib/LTO/LTOBackend.cpp llvm/lib/LTO/ThinLTOCodeGenerator.cpp llvm/lib/Target/NVPTX/NVPTXTargetMachine.h llvm/lib/Target/TargetMachineC.cpp llvm/tools/llc/NewPMDriver.cpp llvm/tools/llc/llc.cpp llvm/tools/llvm-exegesis/lib/Assembler.cpp llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp llvm/tools/llvm-reduce/ReducerWorkItem.cpp llvm/tools/llvm-reduce/ReducerWorkItem.h llvm/tools/llvm-reduce/TestRunner.cpp llvm/tools/llvm-reduce/TestRunner.h llvm/tools/llvm-reduce/deltas/Delta.cpp llvm/tools/llvm-reduce/llvm-reduce.cpp llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp llvm/unittests/CodeGen/AsmPrinterDwarfTest.cpp llvm/unittests/CodeGen/GlobalISel/GISelMITest.h llvm/unittests/CodeGen/InstrRefLDVTest.cpp llvm/unittests/CodeGen/MFCommon.inc llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp llvm/unittests/CodeGen/PassManagerTest.cpp llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp llvm/unittests/MI/LiveIntervalTest.cpp llvm/unittests/MIR/MachineMetadata.cpp llvm/unittests/Target/AArch64/InstSizes.cpp llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp llvm/unittests/Target/AMDGPU/PALMetadata.cpp llvm/unittests/Target/ARM/InstSizes.cpp llvm/unittests/Target/LoongArch/InstSizes.cpp llvm/unittests/Target/RISCV/RISCVInstrInfoTest.cpp llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp llvm/unittests/Target/X86/MachineSizeOptsTest.cpp llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 797f7b4456..4c7112a50c 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -1053,9 +1053,9 @@ Expected<StringRef> compileModule(Module &M, OffloadKind Kind) {
   auto OS = std::make_unique<llvm::raw_fd_ostream>(FD, true);
 
   legacy::PassManager CodeGenPasses;
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   auto MMI = TM->createMachineModuleInfo(MCCtx);
   TargetLibraryInfoImpl TLII(Triple(M.getTargetTriple()));
   CodeGenPasses.add(new TargetLibraryInfoWrapperPass(TLII));
diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
index 3fb0979ec2..268dba6707 100644
--- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -105,8 +105,7 @@ class MachineModuleInfo {
   MachineFunction *LastResult = nullptr; ///< Used for shortcut/cache.
 
 public:
-  explicit MachineModuleInfo(const LLVMTargetMachine &TM,
-                             MCContext &Context);
+  explicit MachineModuleInfo(const LLVMTargetMachine &TM, MCContext &Context);
 
   /// Deleted copy constructor
   MachineModuleInfo(MachineModuleInfo &MMI) = delete;
@@ -121,12 +120,8 @@ public:
 
   const LLVMTargetMachine &getTarget() const { return TM; }
 
-  const MCContext &getContext() const {
-    return Context;
-  }
-  MCContext &getContext() {
-    return Context;
-  }
+  const MCContext &getContext() const { return Context; }
+  MCContext &getContext() { return Context; }
 
   const Module *getModule() const { return TheModule; }
 
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
index f5b1daa2b8..152c942275 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
@@ -47,9 +47,9 @@ Expected<SimpleCompiler::CompileResult> SimpleCompiler::operator()(Module &M) {
     raw_svector_ostream ObjStream(ObjBufferSV);
 
     legacy::PassManager PM;
-    MCContext MCCtx(
-        TM.getTargetTriple(), TM.getMCAsmInfo(), TM.getMCRegisterInfo(),
-        TM.getMCSubtargetInfo(), nullptr, &TM.Options.MCOptions, false);
+    MCContext MCCtx(TM.getTargetTriple(), TM.getMCAsmInfo(),
+                    TM.getMCRegisterInfo(), TM.getMCSubtargetInfo(), nullptr,
+                    &TM.Options.MCOptions, false);
     auto MMI = TM.createMachineModuleInfo(MCCtx);
     if (TM.addPassesToEmitMC(PM, ObjStream, *MMI))
       return make_error<StringError>("Target does not support MC emission",
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 7c50ab6355..83fb4c8204 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -426,14 +426,14 @@ static void codegen(const Config &Conf, TargetMachine *TM,
   if (Conf.PreCodeGenPassesHook)
     Conf.PreCodeGenPassesHook(CodeGenPasses);
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   auto MMI = TM->createMachineModuleInfo(MCCtx);
 
   if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS,
-                              DwoOut ? &DwoOut->os() : nullptr,
-                              Conf.CGFileType, *MMI))
+                              DwoOut ? &DwoOut->os() : nullptr, Conf.CGFileType,
+                              *MMI))
     report_fatal_error("Failed to setup codegen");
   CodeGenPasses.run(Mod);
 
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 831b714032..bc2eda24ea 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -28,9 +28,9 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/LLVMRemarkStreamer.h"
+#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/PassTimingInfo.h"
 #include "llvm/IR/Verifier.h"
@@ -337,9 +337,9 @@ std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
     raw_svector_ostream OS(OutputBuffer);
     legacy::PassManager PM;
 
-    MCContext MCCtx(
-        TM.getTargetTriple(), TM.getMCAsmInfo(), TM.getMCRegisterInfo(),
-        TM.getMCSubtargetInfo(), nullptr, &TM.Options.MCOptions, false);
+    MCContext MCCtx(TM.getTargetTriple(), TM.getMCAsmInfo(),
+                    TM.getMCRegisterInfo(), TM.getMCSubtargetInfo(), nullptr,
+                    &TM.Options.MCOptions, false);
     auto MMI = TM.createMachineModuleInfo(MCCtx);
     // Setup the codegen now.
     if (TM.addPassesToEmitFile(PM, OS, nullptr, CodeGenFileType::ObjectFile,
diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp
index e82a1f9d44..ca29da3fc1 100644
--- a/llvm/lib/Target/TargetMachineC.cpp
+++ b/llvm/lib/Target/TargetMachineC.cpp
@@ -312,10 +312,10 @@ static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
       break;
   }
 
-    MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
-                    TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
-                    &TM->Options.MCOptions, false);
-    auto MMI = TM->createMachineModuleInfo(MCCtx);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
+  auto MMI = TM->createMachineModuleInfo(MCCtx);
 
   if (TM->addPassesToEmitFile(pass, OS, nullptr, ft, *MMI)) {
     error = "TargetMachine can't emit a file of this type";
diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp
index e69d7a8a4c..b031b9280f 100644
--- a/llvm/tools/llc/NewPMDriver.cpp
+++ b/llvm/tools/llc/NewPMDriver.cpp
@@ -108,10 +108,9 @@ int llvm::compileModuleWithNewPM(
   Opt.DebugPM = DebugPM;
   Opt.RegAlloc = RegAlloc;
 
-  llvm::MCContext MCCtx(
-      LLVMTM.getTargetTriple(), LLVMTM.getMCAsmInfo(),
-      LLVMTM.getMCRegisterInfo(), LLVMTM.getMCSubtargetInfo(),
-      nullptr, &LLVMTM.Options.MCOptions, false);
+  llvm::MCContext MCCtx(LLVMTM.getTargetTriple(), LLVMTM.getMCAsmInfo(),
+                        LLVMTM.getMCRegisterInfo(), LLVMTM.getMCSubtargetInfo(),
+                        nullptr, &LLVMTM.Options.MCOptions, false);
   MachineModuleInfo MMI(LLVMTM, MCCtx);
 
   PassInstrumentationCallbacks PIC;
diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
index d73d8f26cc..9bd8f3537c 100644
--- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp
@@ -239,8 +239,8 @@ BitVector getFunctionReservedRegs(const TargetMachine &TM) {
       LLVMTM.getMCRegisterInfo(), LLVMTM.getMCSubtargetInfo(), nullptr,
       &LLVMTM.Options.MCOptions, false);
   auto MMI = std::make_unique<llvm::MachineModuleInfo>(LLVMTM, *MCCtx);
-  MachineFunction &MF = createVoidVoidPtrMachineFunction(
-      FunctionID, Module.get(), MMI.get());
+  MachineFunction &MF =
+      createVoidVoidPtrMachineFunction(FunctionID, Module.get(), MMI.get());
   // Saving reserved registers for client.
   return MF.getSubtarget().getRegisterInfo()->getReservedRegs(MF);
 }
diff --git a/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp b/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
index 49823848ba..1fff27ccff 100644
--- a/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
+++ b/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp
@@ -98,9 +98,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
 
   // Build up a PM to do instruction selection.
   legacy::PassManager PM;
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   auto MMI = TM->createMachineModuleInfo(MCCtx);
   TargetLibraryInfoImpl TLII(TM->getTargetTriple());
   PM.add(new TargetLibraryInfoWrapperPass(TLII));
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index 0b2c3b3f32..3e62214d51 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -785,8 +785,7 @@ void ReducerWorkItem::writeBitcode(raw_ostream &OutStream) const {
 
 std::pair<std::unique_ptr<ReducerWorkItem>, bool>
 llvm::parseReducerWorkItem(StringRef ToolName, StringRef Filename,
-                           LLVMContext &Ctxt,
-                           std::unique_ptr<MCContext> &MCCtx,
+                           LLVMContext &Ctxt, std::unique_ptr<MCContext> &MCCtx,
                            std::unique_ptr<TargetMachine> &TM, bool IsMIR) {
   bool IsBitcode = false;
   Triple TheTriple;
@@ -825,8 +824,7 @@ llvm::parseReducerWorkItem(StringRef ToolName, StringRef Filename,
     std::unique_ptr<Module> M = MParser->parseIRModule(SetDataLayout);
     LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine *>(TM.get());
 
-    MCCtx.reset(new MCContext(LLVMTM->getTargetTriple(),
-                              LLVMTM->getMCAsmInfo(),
+    MCCtx.reset(new MCContext(LLVMTM->getTargetTriple(), LLVMTM->getMCAsmInfo(),
                               LLVMTM->getMCRegisterInfo(),
                               LLVMTM->getMCSubtargetInfo(), nullptr,
                               &LLVMTM->Options.MCOptions, false));
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.h b/llvm/tools/llvm-reduce/ReducerWorkItem.h
index a7288420fc..242046672b 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.h
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.h
@@ -46,7 +46,7 @@ public:
   void print(raw_ostream &ROS, void *p = nullptr) const;
   bool verify(raw_fd_ostream *OS) const;
   std::unique_ptr<ReducerWorkItem> clone(const TargetMachine *TM,
-                                         MCContext * MCCtx) const;
+                                         MCContext *MCCtx) const;
 
   /// Return a number to indicate whether there was any reduction progress.
   uint64_t getComplexityScore() const {
diff --git a/llvm/tools/llvm-reduce/TestRunner.h b/llvm/tools/llvm-reduce/TestRunner.h
index f6c2c57adf..9c69c4fa29 100644
--- a/llvm/tools/llvm-reduce/TestRunner.h
+++ b/llvm/tools/llvm-reduce/TestRunner.h
@@ -45,7 +45,7 @@ public:
 
   const TargetMachine *getTargetMachine() const { return TM.get(); }
 
-  MCContext *getMCContext() const { return MCCtx.get();}
+  MCContext *getMCContext() const { return MCCtx.get(); }
 
   StringRef getToolName() const { return ToolName; }
 
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 415bf3822a..af6c28efaa 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -198,7 +198,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
     std::vector<Chunk> NoChunks = {{0, INT_MAX}};
     Oracle NoChunksCounter(NoChunks);
     std::unique_ptr<ReducerWorkItem> Clone =
-      Test.getProgram().clone(Test.getTargetMachine(), Test.getMCContext());
+        Test.getProgram().clone(Test.getTargetMachine(), Test.getMCContext());
     ExtractChunksFromModule(NoChunksCounter, *Clone);
     assert(Targets == NoChunksCounter.count() &&
            "number of chunks changes when reducing");
diff --git a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
index 129eba9339..bb2d1b90e7 100644
--- a/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
+++ b/llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
@@ -124,8 +124,7 @@ protected:
     SmallString<512> MIRString;
     getTargetTestModuleString(MIRString, ExtraAssembly);
 
-    ModuleMMIPair =
-        createDummyModule(Context, *TM, *MCCtx, MIRString, "func");
+    ModuleMMIPair = createDummyModule(Context, *TM, *MCCtx, MIRString, "func");
     MF = getMFFromMMI(ModuleMMIPair.first.get(), ModuleMMIPair.second.get());
     collectCopies(Copies, MF);
     EntryMBB = &*MF->begin();
diff --git a/llvm/unittests/CodeGen/MFCommon.inc b/llvm/unittests/CodeGen/MFCommon.inc
index 884b26c296..f736dfa9ad 100644
--- a/llvm/unittests/CodeGen/MFCommon.inc
+++ b/llvm/unittests/CodeGen/MFCommon.inc
@@ -132,12 +132,12 @@ std::unique_ptr<MachineFunction> createMachineFunction(LLVMContext &Ctx,
 
   auto TM = createTargetMachine();
   unsigned FunctionNum = 42;
-  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-                  TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   const TargetSubtargetInfo &STI = *TM->getSubtargetImpl(*F);
 
-  return std::make_unique<MachineFunction>(*F, *TM, STI, MCCtx,
-                                           FunctionNum);
+  return std::make_unique<MachineFunction>(*F, *TM, STI, MCCtx, FunctionNum);
 }
 
diff --git a/llvm/unittests/CodeGen/PassManagerTest.cpp b/llvm/unittests/CodeGen/PassManagerTest.cpp
index 98647c746f..1561ab103a 100644
--- a/llvm/unittests/CodeGen/PassManagerTest.cpp
+++ b/llvm/unittests/CodeGen/PassManagerTest.cpp
@@ -181,10 +181,9 @@ TEST_F(PassManagerTest, Basic) {
 
   LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine *>(TM.get());
   M->setDataLayout(TM->createDataLayout());
-  MCContext MCCtx(
-      LLVMTM->getTargetTriple(), LLVMTM->getMCAsmInfo(),
-      LLVMTM->getMCRegisterInfo(), LLVMTM->getMCSubtargetInfo(), nullptr,
-      &LLVMTM->Options.MCOptions, false);
+  MCContext MCCtx(LLVMTM->getTargetTriple(), LLVMTM->getMCAsmInfo(),
+                  LLVMTM->getMCRegisterInfo(), LLVMTM->getMCSubtargetInfo(),
+                  nullptr, &LLVMTM->Options.MCOptions, false);
 
   MachineModuleInfo MMI(*LLVMTM, MCCtx);
 
@@ -236,10 +235,9 @@ TEST_F(PassManagerTest, DiagnosticHandler) {
   LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine *>(TM.get());
   M->setDataLayout(TM->createDataLayout());
 
-  MCContext MCCtx(
-      LLVMTM->getTargetTriple(), LLVMTM->getMCAsmInfo(),
-      LLVMTM->getMCRegisterInfo(), LLVMTM->getMCSubtargetInfo(), nullptr,
-      &LLVMTM->Options.MCOptions, false);
+  MCContext MCCtx(LLVMTM->getTargetTriple(), LLVMTM->getMCAsmInfo(),
+                  LLVMTM->getMCRegisterInfo(), LLVMTM->getMCSubtargetInfo(),
+                  nullptr, &LLVMTM->Options.MCOptions, false);
   MachineModuleInfo MMI(*LLVMTM, MCCtx);
 
   LoopAnalysisManager LAM;
diff --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp
index 4da5a09a7b..17839dd26d 100644
--- a/llvm/unittests/MI/LiveIntervalTest.cpp
+++ b/llvm/unittests/MI/LiveIntervalTest.cpp
@@ -204,8 +204,8 @@ static void doTest(StringRef MIRFunc,
   LLVMContext Context;
   std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine();
   MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
-                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(),
-                  nullptr, &TM->Options.MCOptions, false);
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   // This test is designed for the X86 backend; stop if it is not available.
   if (!TM)
     return;
diff --git a/llvm/unittests/MIR/MachineMetadata.cpp b/llvm/unittests/MIR/MachineMetadata.cpp
index d7f0df21db..771133d2b3 100644
--- a/llvm/unittests/MIR/MachineMetadata.cpp
+++ b/llvm/unittests/MIR/MachineMetadata.cpp
@@ -225,9 +225,9 @@ body:             |
   %1:gpr32 = LDRWui %0, 0 :: (load (s32) from %ir.p)
 ...
 )MIR";
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "test0", MMI);
   ASSERT_TRUE(M);
@@ -339,9 +339,9 @@ body:             |
 ...
 )MIR";
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "test0", MMI);
   ASSERT_TRUE(M);
@@ -380,9 +380,9 @@ body:             |
 ...
 )MIR";
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "test0", MMI);
   ASSERT_TRUE(M);
@@ -481,9 +481,9 @@ body:             |
 ...
 )MIR";
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "test0", MMI);
   ASSERT_TRUE(M);
@@ -573,9 +573,9 @@ body:             |
 
 ...
 )MIR";
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "foo", MMI);
   ASSERT_TRUE(M);
@@ -607,9 +607,9 @@ body:             |
 
 ...
 )MIR";
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   M = parseMIR(*TM, MIRString, "foo", MMI);
   ASSERT_TRUE(M);
diff --git a/llvm/unittests/Target/AArch64/InstSizes.cpp b/llvm/unittests/Target/AArch64/InstSizes.cpp
index 35092610e7..a35d674f49 100644
--- a/llvm/unittests/Target/AArch64/InstSizes.cpp
+++ b/llvm/unittests/Target/AArch64/InstSizes.cpp
@@ -74,9 +74,9 @@ void runChecks(
   M->setTargetTriple(TM->getTargetTriple().getTriple());
   M->setDataLayout(TM->createDataLayout());
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   bool Res = MParser->parseMachineFunctions(*M, MMI);
   ASSERT_FALSE(Res);
diff --git a/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp b/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp
index a33e337e19..a192a0d9a1 100644
--- a/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp
+++ b/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp
@@ -28,11 +28,10 @@ TEST(AMDGPU, ExecMayBeModifiedBeforeAnyUse) {
   auto *Type = FunctionType::get(Type::getVoidTy(Ctx), false);
   auto *F = Function::Create(Type, GlobalValue::ExternalLinkage, "Test", &Mod);
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
-  auto MF =
-      std::make_unique<MachineFunction>(*F, *TM, ST, MCCtx, 42);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
+  auto MF = std::make_unique<MachineFunction>(*F, *TM, ST, MCCtx, 42);
   auto *BB = MF->CreateMachineBasicBlock();
   MF->push_back(BB);
 
diff --git a/llvm/unittests/Target/ARM/InstSizes.cpp b/llvm/unittests/Target/ARM/InstSizes.cpp
index 3c16dafdc3..f584f34bef 100644
--- a/llvm/unittests/Target/ARM/InstSizes.cpp
+++ b/llvm/unittests/Target/ARM/InstSizes.cpp
@@ -24,9 +24,9 @@ void runChecks(
     std::function<void(const ARMBaseInstrInfo &, MachineFunction &, unsigned &)>
         Checks) {
   LLVMContext Context;
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
 
   auto MIRString = "--- |\n"
                    "  declare void @sizes()\n" +
diff --git a/llvm/unittests/Target/LoongArch/InstSizes.cpp b/llvm/unittests/Target/LoongArch/InstSizes.cpp
index 26a7d3594e..42bdd5bda7 100644
--- a/llvm/unittests/Target/LoongArch/InstSizes.cpp
+++ b/llvm/unittests/Target/LoongArch/InstSizes.cpp
@@ -73,9 +73,9 @@ void runChecks(
   M->setTargetTriple(TM->getTargetTriple().getTriple());
   M->setDataLayout(TM->createDataLayout());
 
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
 
   MachineModuleInfo MMI(*TM, MCCtx);
   bool Res = MParser->parseMachineFunctions(*M, MMI);
diff --git a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
index fb341406d7..47129db813 100644
--- a/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
+++ b/llvm/unittests/Target/WebAssembly/WebAssemblyExceptionInfoTest.cpp
@@ -155,9 +155,9 @@ body: |
 )MIR";
 
   LLVMContext Context;
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   std::unique_ptr<MIRParser> MIR;
   MachineModuleInfo MMI(*TM, MCCtx);
   std::unique_ptr<Module> M =
@@ -334,9 +334,9 @@ body: |
 
   LLVMContext Context;
   std::unique_ptr<MIRParser> MIR;
-  MCContext MCCtx(
-      TM->getTargetTriple(), TM->getMCAsmInfo(), TM->getMCRegisterInfo(),
-      TM->getMCSubtargetInfo(), nullptr, &TM->Options.MCOptions, false);
+  MCContext MCCtx(TM->getTargetTriple(), TM->getMCAsmInfo(),
+                  TM->getMCRegisterInfo(), TM->getMCSubtargetInfo(), nullptr,
+                  &TM->Options.MCOptions, false);
   MachineModuleInfo MMI(*TM, MCCtx);
   std::unique_ptr<Module> M =
       parseMIR(Context, MIR, *TM, MIRString, "test1", MMI);

``````````

</details>


https://github.com/llvm/llvm-project/pull/105541


More information about the llvm-commits mailing list