From 53fec21fbea746cd22b86c8dfacd2ccd6984c1af Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 28 Apr 2015 17:37:03 +0000 Subject: [PATCH] R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes a crash with basically any OpenGL application using the radeonsi driver. Patch by: Michel Dänzer Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90176 Signed-off-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236004 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/AMDGPUMCInstLower.cpp | 5 +++-- test/CodeGen/R600/debug.ll | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/R600/debug.ll diff --git a/lib/Target/R600/AMDGPUMCInstLower.cpp b/lib/Target/R600/AMDGPUMCInstLower.cpp index b00bd8d9490..0aa1a9a2a2c 100644 --- a/lib/Target/R600/AMDGPUMCInstLower.cpp +++ b/lib/Target/R600/AMDGPUMCInstLower.cpp @@ -132,8 +132,9 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) { SmallVector CodeBytes; raw_svector_ostream CodeStream(CodeBytes); - MCObjectStreamer &ObjStreamer = (MCObjectStreamer &)OutStreamer; - MCCodeEmitter &InstEmitter = ObjStreamer.getAssembler().getEmitter(); + MCObjectStreamer *ObjStreamer = + static_cast(OutStreamer.get()); + MCCodeEmitter &InstEmitter = ObjStreamer->getAssembler().getEmitter(); InstEmitter.EncodeInstruction(TmpInst, CodeStream, Fixups, MF->getSubtarget()); CodeStream.flush(); diff --git a/test/CodeGen/R600/debug.ll b/test/CodeGen/R600/debug.ll new file mode 100644 index 00000000000..a2e0e878b74 --- /dev/null +++ b/test/CodeGen/R600/debug.ll @@ -0,0 +1,10 @@ +; RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs -mattr=dumpcode -filetype=obj | FileCheck --check-prefix=SI --check-prefix=FUNC %s +; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs -mattr=dumpcode -filetype=obj | FileCheck --check-prefix=SI --check-prefix=FUNC %s + +; Test for a crash in the custom assembly dump code. + +; SI: s_endpgm +define void @test(i32 addrspace(1)* %out) { + store i32 0, i32 addrspace(1)* %out + ret void +} -- 2.34.1