diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-01-06 22:01:04 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-01-06 22:01:04 +0000 |
commit | a61e5a8d4ebaae5d54f22c3564bfd77f3d7cf8a2 (patch) | |
tree | 4fd7b05b4fb598c56f43ecb44f35bf30bc2b1c46 | |
parent | 0f56118c57387fe478742953519514cc350c5ea1 (diff) | |
download | bcm5719-llvm-a61e5a8d4ebaae5d54f22c3564bfd77f3d7cf8a2.tar.gz bcm5719-llvm-a61e5a8d4ebaae5d54f22c3564bfd77f3d7cf8a2.zip |
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
llvm-svn: 256980
-rw-r--r-- | llvm/lib/Target/AMDGPU/SITypeRewriter.cpp | 3 | ||||
-rw-r--r-- | llvm/test/CodeGen/AMDGPU/inline-asm.ll | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/SITypeRewriter.cpp b/llvm/lib/Target/AMDGPU/SITypeRewriter.cpp index dbdc76b917f..d36c5d29b12 100644 --- a/llvm/lib/Target/AMDGPU/SITypeRewriter.cpp +++ b/llvm/lib/Target/AMDGPU/SITypeRewriter.cpp @@ -98,6 +98,9 @@ void SITypeRewriter::visitCallInst(CallInst &I) { 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); diff --git a/llvm/test/CodeGen/AMDGPU/inline-asm.ll b/llvm/test/CodeGen/AMDGPU/inline-asm.ll index efc2292de3a..9c8d3534f8a 100644 --- a/llvm/test/CodeGen/AMDGPU/inline-asm.ll +++ b/llvm/test/CodeGen/AMDGPU/inline-asm.ll @@ -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" } |