1; To test that __tsan_func_exit always happen before musttaill call and no exception handling code. 2; RUN: opt < %s -tsan -S | FileCheck %s 3 4define internal i32 @preallocated_musttail(i32* preallocated(i32) %p) sanitize_thread { 5 %rv = load i32, i32* %p 6 ret i32 %rv 7} 8 9define i32 @call_preallocated_musttail(i32* preallocated(i32) %a) sanitize_thread { 10 %r = musttail call i32 @preallocated_musttail(i32* preallocated(i32) %a) 11 ret i32 %r 12} 13 14; CHECK-LABEL: define i32 @call_preallocated_musttail(i32* preallocated(i32) %a) 15; CHECK: call void @__tsan_func_exit() 16; CHECK-NEXT: %r = musttail call i32 @preallocated_musttail(i32* preallocated(i32) %a) 17; CHECK-NEXT: ret i32 %r 18 19 20define i32 @call_preallocated_musttail_cast(i32* preallocated(i32) %a) sanitize_thread { 21 %r = musttail call i32 @preallocated_musttail(i32* preallocated(i32) %a) 22 %t = bitcast i32 %r to i32 23 ret i32 %t 24} 25 26; CHECK-LABEL: define i32 @call_preallocated_musttail_cast(i32* preallocated(i32) %a) 27; CHECK: call void @__tsan_func_exit() 28; CHECK-NEXT: %r = musttail call i32 @preallocated_musttail(i32* preallocated(i32) %a) 29; CHECK-NEXT: %t = bitcast i32 %r to i32 30; CHECK-NEXT: ret i32 %t 31