From: Eric Christopher Date: Thu, 19 Feb 2015 23:52:35 +0000 (+0000) Subject: Only use the initialized MCInstrInfo if it's been initialized already X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=19f93ebf180d7a547d5138a261becc275b4fbc83;p=oota-llvm.git Only use the initialized MCInstrInfo if it's been initialized already during SetupMachineFunction. This is also the single use of MII and it'll be changing to TargetInstrInfo (which is MachineFunction based) in the next commit here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229931 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index a2e5460a6c6..57f05be35c9 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -148,8 +148,12 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, // emitInlineAsmEnd(). MCSubtargetInfo STIOrig = *STI; + // We may create a new MCInstrInfo here since we might be at the module level + // and not have a MachineFunction to initialize the TargetInstrInfo from and + // we only need MCInstrInfo for asm parsing. std::unique_ptr TAP(TM.getTarget().createMCAsmParser( - *STI, *Parser, *MII, TM.Options.MCOptions)); + *STI, *Parser, MII ? *MII : *TM.getTarget().createMCInstrInfo(), + TM.Options.MCOptions)); if (!TAP) report_fatal_error("Inline asm not supported by this streamer because" " we don't have an asm parser for this target\n");