From 9abdfd01703c9acfcbbdb160ab4d19e531f098e3 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Sat, 21 Feb 2015 09:09:15 +0000 Subject: [PATCH] Unconditionally create a new MCInstrInfo in the asm printer for asm parsing since it's not subtarget dependent and we can't depend upon the one hanging off the MachineFunction's subtarget still being around. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230135 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index c95777e40d1..e6e7c973c18 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -149,12 +149,11 @@ 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 + // We 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. - const MCInstrInfo *MII = - MF ? static_cast(MF->getSubtarget().getInstrInfo()) - : static_cast(TM.getTarget().createMCInstrInfo()); + // we only need MCInstrInfo for asm parsing. We create one unconditionally + // because it's not subtarget dependent. + std::unique_ptr MII(TM.getTarget().createMCInstrInfo()); std::unique_ptr TAP(TM.getTarget().createMCAsmParser( *STI, *Parser, *MII, TM.Options.MCOptions)); if (!TAP) -- 2.34.1