[llvm] r256980 - AMDGPU/SI: Fix crash when inline assembly is used in a graphics shader
Nicolai Haehnle via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 6 14:01:04 PST 2016
Author: nha
Date: Wed Jan 6 16:01:04 2016
New Revision: 256980
URL: http://llvm.org/viewvc/llvm-project?rev=256980&view=rev
Log:
AMDGPU/SI: Fix crash when inline assembly is used in a graphics shader
Summary:
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.
Reviewers: arsenm, tstellarAMD
Subscribers: arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D15902
Modified:
llvm/trunk/lib/Target/AMDGPU/SITypeRewriter.cpp
llvm/trunk/test/CodeGen/AMDGPU/inline-asm.ll
Modified: llvm/trunk/lib/Target/AMDGPU/SITypeRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SITypeRewriter.cpp?rev=256980&r1=256979&r2=256980&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SITypeRewriter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SITypeRewriter.cpp Wed Jan 6 16:01:04 2016
@@ -98,6 +98,9 @@ void SITypeRewriter::visitCallInst(CallI
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);
Modified: llvm/trunk/test/CodeGen/AMDGPU/inline-asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/inline-asm.ll?rev=256980&r1=256979&r2=256980&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/inline-asm.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/inline-asm.ll Wed Jan 6 16:01:04 2016
@@ -10,3 +10,14 @@ entry:
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" }
More information about the llvm-commits
mailing list