1 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
3 %swift_error = type {i64, i8}
5 ; CHECK: swifterror value can only be loaded and stored from, or as a swifterror argument!
6 ; CHECK: ptr %error_ptr_ref
7 ; CHECK: %t = getelementptr inbounds ptr, ptr %error_ptr_ref, i64 1
8 define float @foo(ptr swifterror %error_ptr_ref) {
9 %t = getelementptr inbounds ptr, ptr %error_ptr_ref, i64 1
13 ; CHECK: swifterror argument for call has mismatched alloca
14 ; CHECK: %error_ptr_ref = alloca ptr
15 ; CHECK: %call = call float @foo(ptr swifterror %error_ptr_ref)
16 define float @caller(ptr %error_ref) {
18 %error_ptr_ref = alloca ptr
19 store ptr null, ptr %error_ptr_ref
20 %call = call float @foo(ptr swifterror %error_ptr_ref)
24 ; CHECK: swifterror alloca must have pointer type
25 define void @swifterror_alloca_invalid_type() {
26 %a = alloca swifterror i128
30 ; CHECK: swifterror alloca must not be array allocation
31 define void @swifterror_alloca_array() {
32 %a = alloca swifterror ptr, i64 2
36 ; CHECK: Cannot have multiple 'swifterror' parameters!
37 declare void @a(ptr swifterror %a, ptr swifterror %b)
39 ; CHECK: Attribute 'swifterror' applied to incompatible type!
40 declare void @b(i32 swifterror %a)