1 ; RUN: opt < %s -tsan -S | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-EXC
2 ; RUN: opt < %s -tsan -S -tsan-handle-cxx-exceptions=0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOEXC
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
6 declare void @can_throw()
7 declare void @cannot_throw() nounwind
9 define i32 @func1() sanitize_thread {
10 call void @can_throw()
12 ; CHECK-EXC: define i32 @func1()
13 ; CHECK-EXC: call void @__tsan_func_entry
14 ; CHECK-EXC: invoke void @can_throw()
16 ; CHECK-EXC: call void @__tsan_func_exit()
17 ; CHECK-EXC: ret i32 0
18 ; CHECK-EXC: tsan_cleanup:
19 ; CHECK-EXC: call void @__tsan_func_exit()
21 ; CHECK-NOEXC: define i32 @func1()
22 ; CHECK-NOEXC: call void @__tsan_func_entry
23 ; CHECK-NOEXC: call void @can_throw()
24 ; CHECK-NOEXC: call void @__tsan_func_exit()
25 ; CHECK-NOEXC: ret i32 0
28 define i32 @func2() sanitize_thread {
29 call void @cannot_throw()
31 ; CHECK: define i32 @func2()
32 ; CHECK: call void @__tsan_func_entry
33 ; CHECK: call void @cannot_throw()
34 ; CHECK: call void @__tsan_func_exit()
38 define i32 @func3(i32* %p) sanitize_thread {
39 %a = load i32, i32* %p
41 ; CHECK: define i32 @func3(i32* %p)
42 ; CHECK: call void @__tsan_func_entry
43 ; CHECK: call void @__tsan_read4
44 ; CHECK: %a = load i32, i32* %p
45 ; CHECK: call void @__tsan_func_exit()
49 define i32 @func4() sanitize_thread nounwind {
50 call void @can_throw()
52 ; CHECK: define i32 @func4()
53 ; CHECK: call void @__tsan_func_entry
54 ; CHECK: call void @can_throw()
55 ; CHECK: call void @__tsan_func_exit()