[PATCH] D15902: AMDGPU/SI: Fix crash when inline assembly is used in a graphics shader
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 5 13:33:43 PST 2016
nhaehnle created this revision.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.
This is admittedly something that you could only run into by manually
playing around with shader assembly because the SITypeWriter pass is
skipped for compute.
http://reviews.llvm.org/D15902
Files:
lib/Target/AMDGPU/SITypeRewriter.cpp
test/CodeGen/AMDGPU/inline-asm.ll
Index: test/CodeGen/AMDGPU/inline-asm.ll
===================================================================
--- test/CodeGen/AMDGPU/inline-asm.ll
+++ test/CodeGen/AMDGPU/inline-asm.ll
@@ -10,3 +10,15 @@
call void asm sideeffect "s_endpgm", ""()
ret void
}
+
+; CHECK: {{^}}inline_asm_shader:
+; CHECK: s_endpgm
+; CHECK: s_endpgm
+define void @inline_asm_shader() #0 {
+entry:
+ store i32 5, i32 addrspace(1)* %out
+ call void asm sideeffect "s_endpgm", ""()
+ ret void
+}
+
+attributes #0 = { "ShaderType"="0" }
Index: lib/Target/AMDGPU/SITypeRewriter.cpp
===================================================================
--- lib/Target/AMDGPU/SITypeRewriter.cpp
+++ lib/Target/AMDGPU/SITypeRewriter.cpp
@@ -98,6 +98,9 @@
SmallVector <Type*, 8> Types;
bool NeedToReplace = false;
Function *F = I.getCalledFunction();
+ if (!F)
+ return;
+
std::string Name = F->getName();
for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i) {
Value *Arg = I.getArgOperand(i);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15902.44051.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160105/bf3c5088/attachment.bin>
More information about the llvm-commits
mailing list