1 ; To test that __tsan_func_exit always happen before musttaill call and no exception handling code.
2 ; RUN: opt < %s -passes=tsan -S | FileCheck %s
4 define internal i32 @preallocated_musttail(ptr preallocated(i32) %p) sanitize_thread {
9 define i32 @call_preallocated_musttail(ptr preallocated(i32) %a) sanitize_thread {
10 %r = musttail call i32 @preallocated_musttail(ptr preallocated(i32) %a)
14 ; CHECK-LABEL: define i32 @call_preallocated_musttail(ptr preallocated(i32) %a)
15 ; CHECK: call void @__tsan_func_exit()
16 ; CHECK-NEXT: %r = musttail call i32 @preallocated_musttail(ptr preallocated(i32) %a)
17 ; CHECK-NEXT: ret i32 %r
20 define i32 @call_preallocated_musttail_cast(ptr preallocated(i32) %a) sanitize_thread {
21 %r = musttail call i32 @preallocated_musttail(ptr preallocated(i32) %a)
22 %t = bitcast i32 %r to i32
26 ; CHECK-LABEL: define i32 @call_preallocated_musttail_cast(ptr preallocated(i32) %a)
27 ; CHECK: call void @__tsan_func_exit()
28 ; CHECK-NEXT: %r = musttail call i32 @preallocated_musttail(ptr preallocated(i32) %a)
29 ; CHECK-NEXT: %t = bitcast i32 %r to i32
30 ; CHECK-NEXT: ret i32 %t