[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:40:57 PST 2016
nhaehnle updated this revision to Diff 44052.
nhaehnle added a comment.
Actually add the correct test.
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,14 @@
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:
+ 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.44052.patch
Type: text/x-patch
Size: 967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160105/b8158ad7/attachment.bin>
More information about the llvm-commits
mailing list