41 lines · plain
1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s2 3%swift_error = type {i64, i8}4 5; CHECK: swifterror value can only be loaded and stored from, or as a swifterror argument!6; CHECK: ptr %error_ptr_ref7; CHECK: %t = getelementptr inbounds ptr, ptr %error_ptr_ref, i64 18define float @foo(ptr swifterror %error_ptr_ref) {9 %t = getelementptr inbounds ptr, ptr %error_ptr_ref, i64 110 ret float 1.011}12 13; CHECK: swifterror argument for call has mismatched alloca14; CHECK: %error_ptr_ref = alloca ptr15; CHECK: %call = call float @foo(ptr swifterror %error_ptr_ref)16define float @caller(ptr %error_ref) {17entry:18 %error_ptr_ref = alloca ptr19 store ptr null, ptr %error_ptr_ref20 %call = call float @foo(ptr swifterror %error_ptr_ref)21 ret float 1.022}23 24; CHECK: swifterror alloca must have pointer type25define void @swifterror_alloca_invalid_type() {26 %a = alloca swifterror i12827 ret void28}29 30; CHECK: swifterror alloca must not be array allocation31define void @swifterror_alloca_array() {32 %a = alloca swifterror ptr, i64 233 ret void34}35 36; CHECK: Cannot have multiple 'swifterror' parameters!37declare void @a(ptr swifterror %a, ptr swifterror %b)38 39; CHECK: Attribute 'swifterror' applied to incompatible type!40declare void @b(i32 swifterror %a)41