[llvm] r269948 - AMDGPU: Fix assert when erroring on a call
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 09:10:12 PDT 2016
Author: arsenm
Date: Wed May 18 11:10:11 2016
New Revision: 269948
URL: http://llvm.org/viewvc/llvm-project?rev=269948&view=rev
Log:
AMDGPU: Fix assert when erroring on a call
For some reason an assert is now hit when a valid chain
is not returned, so return the entry chain.
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=269948&r1=269947&r2=269948&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Wed May 18 11:10:11 2016
@@ -619,7 +619,11 @@ SDValue AMDGPUTargetLowering::LowerCall(
DiagnosticInfoUnsupported NoCalls(
Fn, "unsupported call to function " + FuncName, CLI.DL.getDebugLoc());
DAG.getContext()->diagnose(NoCalls);
- return SDValue();
+
+ for (unsigned I = 0, E = CLI.Ins.size(); I != E; ++I)
+ InVals.push_back(DAG.getUNDEF(CLI.Ins[I].VT));
+
+ return DAG.getEntryNode();
}
SDValue AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
Modified: llvm/trunk/test/CodeGen/AMDGPU/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/call.ll?rev=269948&r1=269947&r2=269948&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/call.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/call.ll Wed May 18 11:10:11 2016
@@ -1,8 +1,10 @@
-; RUN: not llc -march=amdgcn -mcpu=SI -verify-machineinstrs -exit-on-error < %s 2>&1 | FileCheck %s
-; RUN: not llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -exit-on-error < %s 2>&1 | FileCheck %s
-; RUN: not llc -march=r600 -mcpu=cypress -exit-on-error < %s 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -verify-machineinstrs < %s 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s 2>&1 | FileCheck %s
+; RUN: not llc -march=r600 -mcpu=cypress < %s 2>&1 | FileCheck %s
; 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
declare i32 @external_function(i32) nounwind
@@ -30,4 +32,14 @@ define void @test_call(i32 addrspace(1)*
%result = add i32 %a, %c
store i32 %result, i32 addrspace(1)* %out
ret void
+}
+
+define void @test_tail_call(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
+ %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
+ %a = load i32, i32 addrspace(1)* %in
+ %b = load i32, i32 addrspace(1)* %b_ptr
+ %c = tail call i32 @defined_function(i32 %b) nounwind
+ %result = add i32 %a, %c
+ store i32 %result, i32 addrspace(1)* %out
+ ret void
}
More information about the llvm-commits
mailing list