diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index bad5670010aa..cf1ed3493020 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -326,7 +326,8 @@ void AMDGPUAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration()); EmitLinkage(GV, GVSym); - getTargetStreamer()->emitAMDGPULDS(GVSym, Size, Align); + if (auto TS = getTargetStreamer()) + TS->emitAMDGPULDS(GVSym, Size, Align); return; }