[llvm] r289868 - AMDGPU: Fix asserting on returned tail calls
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 12:50:12 PST 2016
Author: arsenm
Date: Thu Dec 15 14:50:12 2016
New Revision: 289868
URL: http://llvm.org/viewvc/llvm-project?rev=289868&view=rev
Log:
AMDGPU: Fix asserting on returned tail calls
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/trunk/test/CodeGen/AMDGPU/call.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=289868&r1=289867&r2=289868&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Thu Dec 15 14:50:12 2016
@@ -789,8 +789,10 @@ SDValue AMDGPUTargetLowering::LowerCall(
Fn, "unsupported call to function " + FuncName, CLI.DL.getDebugLoc());
DAG.getContext()->diagnose(NoCalls);
- for (unsigned I = 0, E = CLI.Ins.size(); I != E; ++I)
- InVals.push_back(DAG.getUNDEF(CLI.Ins[I].VT));
+ if (!CLI.IsTailCall) {
+ for (unsigned I = 0, E = CLI.Ins.size(); I != E; ++I)
+ InVals.push_back(DAG.getUNDEF(CLI.Ins[I].VT));
+ }
return DAG.getEntryNode();
}
Modified: llvm/trunk/test/CodeGen/AMDGPU/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/call.ll?rev=289868&r1=289867&r2=289868&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/call.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/call.ll Thu Dec 15 14:50:12 2016
@@ -5,6 +5,7 @@
; CHECK: in function test_call_external{{.*}}: unsupported call to function external_function
; CHECK: in function test_call{{.*}}: unsupported call to function defined_function
; CHECK: in function test_tail_call{{.*}}: unsupported call to function defined_function
+; CHECK: in function test_tail_call_bitcast_extern_variadic{{.*}}: unsupported call to function extern_variadic
declare i32 @external_function(i32) nounwind
@@ -43,3 +44,16 @@ define void @test_tail_call(i32 addrspac
store i32 %result, i32 addrspace(1)* %out
ret void
}
+
+define i32 @test_tail_call_ret() {
+ %call = call i32 @external_function(i32 10)
+ ret i32 %call
+}
+
+declare i32 @extern_variadic(...)
+
+define i32 @test_tail_call_bitcast_extern_variadic(<4 x float> %arg0, <4 x float> %arg1, i32 %arg2) {
+ %add = fadd <4 x float> %arg0, %arg1
+ %call = tail call i32 bitcast (i32 (...)* @extern_variadic to i32 (<4 x float>)*)(<4 x float> %add) #7
+ ret i32 %call
+}
More information about the llvm-commits
mailing list