Index: lib/Target/X86/X86AsmPrinter.cpp =================================================================== --- lib/Target/X86/X86AsmPrinter.cpp +++ lib/Target/X86/X86AsmPrinter.cpp @@ -92,15 +92,17 @@ static_cast(OutStreamer->getTargetStreamer()); unsigned ParamsSize = MF->getInfo()->getArgumentStackSize(); - XTS->emitFPOProc(CurrentFnSym, ParamsSize); + + if (XTS) + XTS->emitFPOProc(CurrentFnSym, ParamsSize); } } void X86AsmPrinter::EmitFunctionBodyEnd() { if (EmitFPOData) { - X86TargetStreamer *XTS = - static_cast(OutStreamer->getTargetStreamer()); - XTS->emitFPOEndProc(); + if (X86TargetStreamer *XTS = + static_cast(OutStreamer->getTargetStreamer())) + XTS->emitFPOEndProc(); } } Index: test/CodeGen/X86/null-streamer.ll =================================================================== --- test/CodeGen/X86/null-streamer.ll +++ test/CodeGen/X86/null-streamer.ll @@ -14,7 +14,7 @@ } !llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!7, !8} +!llvm.module.flags = !{!7, !8, !9} !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: " ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !3, imports: !2) !1 = !DIFile(filename: "file.c", directory: "") @@ -25,4 +25,4 @@ !6 = !DIBasicType(size: 32, align: 32, encoding: DW_ATE_signed) !7 = !{i32 2, !"Dwarf Version", i32 3} !8 = !{i32 1, !"Debug Info Version", i32 3} - +!9 = !{i32 2, !"CodeView", i32 1}