[llvm] e03c8d3 - [AsmPrinter] Remove unneeded MCSubtargetInfo temporary after D14346. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 4 10:50:15 PDT 2021


Author: Fangrui Song
Date: 2021-09-04T10:50:10-07:00
New Revision: e03c8d309aa5f2551a31dd14941a71c300956d12

URL: https://github.com/llvm/llvm-project/commit/e03c8d309aa5f2551a31dd14941a71c300956d12
DIFF: https://github.com/llvm/llvm-project/commit/e03c8d309aa5f2551a31dd14941a71c300956d12.diff

LOG: [AsmPrinter] Remove unneeded MCSubtargetInfo temporary after D14346. NFC

The temporary object was used as a workaround when the target parser may
change STI. D14346 made the MCSubtargetInfo argument to
createMCAsmParser const, so we no longer need the temporary object.

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 4f48d007a1530..f17542d10b9d1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -326,16 +326,10 @@ bool AsmPrinter::doInitialization(Module &M) {
 
   // Emit module-level inline asm if it exists.
   if (!M.getModuleInlineAsm().empty()) {
-    // We're at the module level. Construct MCSubtarget from the default CPU
-    // and target triple.
-    std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo(
-        TM.getTargetTriple().str(), TM.getTargetCPU(),
-        TM.getTargetFeatureString()));
-    assert(STI && "Unable to create subtarget info");
     OutStreamer->AddComment("Start of file scope inline assembly");
     OutStreamer->AddBlankLine();
-    emitInlineAsm(M.getModuleInlineAsm() + "\n",
-                  OutContext.getSubtargetCopy(*STI), TM.Options.MCOptions);
+    emitInlineAsm(M.getModuleInlineAsm() + "\n", *TM.getMCSubtargetInfo(),
+                  TM.Options.MCOptions);
     OutStreamer->AddComment("End of file scope inline assembly");
     OutStreamer->AddBlankLine();
   }


        


More information about the llvm-commits mailing list