[llvm] r236004 - R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

Tom Stellard thomas.stellard at amd.com
Tue Apr 28 10:37:04 PDT 2015


Author: tstellar
Date: Tue Apr 28 12:37:03 2015
New Revision: 236004

URL: http://llvm.org/viewvc/llvm-project?rev=236004&view=rev
Log:
R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

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 <michel.daenzer at amd.com>

Added:
    llvm/trunk/test/CodeGen/R600/debug.ll
Modified:
    llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp

Modified: llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp?rev=236004&r1=236003&r2=236004&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp Tue Apr 28 12:37:03 2015
@@ -132,8 +132,9 @@ void AMDGPUAsmPrinter::EmitInstruction(c
       SmallVector<char, 16> CodeBytes;
       raw_svector_ostream CodeStream(CodeBytes);
 
-      MCObjectStreamer &ObjStreamer = (MCObjectStreamer &)OutStreamer;
-      MCCodeEmitter &InstEmitter = ObjStreamer.getAssembler().getEmitter();
+      MCObjectStreamer *ObjStreamer =
+          static_cast<MCObjectStreamer *>(OutStreamer.get());
+      MCCodeEmitter &InstEmitter = ObjStreamer->getAssembler().getEmitter();
       InstEmitter.EncodeInstruction(TmpInst, CodeStream, Fixups,
                                     MF->getSubtarget<MCSubtargetInfo>());
       CodeStream.flush();

Added: llvm/trunk/test/CodeGen/R600/debug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/debug.ll?rev=236004&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/debug.ll (added)
+++ llvm/trunk/test/CodeGen/R600/debug.ll Tue Apr 28 12:37:03 2015
@@ -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
+}






More information about the llvm-commits mailing list