xref: /llvm-project/llvm/test/tools/llvm-reduce/reduce-instructions-swifterror.ll (revision f4cb935ce8ade596a3f027870b8e2d90c94870ba)
1; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=instructions --test FileCheck --test-arg --check-prefixes=CHECK,INTERESTING --test-arg %s --test-arg --input-file %s -o %t
2; RUN: FileCheck -check-prefixes=CHECK,RESULT %s < %t
3
4; Make sure verifier errors aren't produced from trying to delete
5; swifterror instructions.
6
7%swift_error = type { i64, i8 }
8
9declare float @foo(ptr swifterror %error_ptr_ref)
10
11; CHECK-LABEL: define float @caller(
12; INTERESTING: call float @foo(
13
14; RESULT: %error_ptr_ref = alloca swifterror ptr, align 8
15; RESULT-NEXT: %call = call float @foo(ptr swifterror %error_ptr_ref)
16; RESULT-NEXT: ret float
17define float @caller(ptr %error_ref) {
18entry:
19  %error_ptr_ref = alloca swifterror ptr
20  store ptr null, ptr %error_ptr_ref
21  %call = call float @foo(ptr swifterror %error_ptr_ref)
22  %error_from_foo = load ptr, ptr %error_ptr_ref
23  %had_error_from_foo = icmp ne ptr %error_from_foo, null
24  %v1 = getelementptr inbounds %swift_error, ptr %error_from_foo, i64 0, i32 1
25  %t = load i8, ptr %v1
26  store i8 %t, ptr %error_ref
27  ret float 1.0
28}
29