summaryrefslogtreecommitdiff
path: root/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll')
-rw-r--r--test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll b/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll
new file mode 100644
index 0000000000000..10739df083790
--- /dev/null
+++ b/test/CodeGen/AMDGPU/promote-alloca-bitcast-function.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -march=amdgcn < %s 2>&1 | FileCheck %s
+
+; Make sure that AMDGPUPromoteAlloca doesn't crash if the called
+; function is a constantexpr cast of a function.
+
+declare void @foo(float*) #0
+declare void @foo.varargs(...) #0
+
+; CHECK: error: unsupported call to function foo in crash_call_constexpr_cast
+define void @crash_call_constexpr_cast() #0 {
+ %alloca = alloca i32
+ call void bitcast (void (float*)* @foo to void (i32*)*)(i32* %alloca) #0
+ ret void
+}
+
+define void @crash_call_constexpr_cast_varargs() #0 {
+ %alloca = alloca i32
+ call void bitcast (void (...)* @foo.varargs to void (i32*)*)(i32* %alloca) #0
+ ret void
+}
+
+attributes #0 = { nounwind }