From 3f05e1a19bc9f588272ab1847a5093e4162f3f5e 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. llvm-svn: 230135 --- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index c95777e40d1b..e6e7c973c18f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/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)