xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: not llc -march=amdgcn < %s 2>&1 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Make sure that AMDGPUPromoteAlloca doesn't crash if the called
4*9880d681SAndroid Build Coastguard Worker; function is a constantexpr cast of a function.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare void @foo(float*) #0
7*9880d681SAndroid Build Coastguard Workerdeclare void @foo.varargs(...) #0
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; CHECK: in function crash_call_constexpr_cast{{.*}}: unsupported call to function foo
10*9880d681SAndroid Build Coastguard Workerdefine void @crash_call_constexpr_cast() #0 {
11*9880d681SAndroid Build Coastguard Worker  %alloca = alloca i32
12*9880d681SAndroid Build Coastguard Worker  call void bitcast (void (float*)* @foo to void (i32*)*)(i32* %alloca) #0
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; CHECK: in function crash_call_constexpr_cast{{.*}}: unsupported call to function foo.varargs
17*9880d681SAndroid Build Coastguard Workerdefine void @crash_call_constexpr_cast_varargs() #0 {
18*9880d681SAndroid Build Coastguard Worker  %alloca = alloca i32
19*9880d681SAndroid Build Coastguard Worker  call void bitcast (void (...)* @foo.varargs to void (i32*)*)(i32* %alloca) #0
20*9880d681SAndroid Build Coastguard Worker  ret void
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind }
24