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 3 4target 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" 5 6declare void @can_throw() 7declare void @cannot_throw() nounwind 8 9define i32 @func1() sanitize_thread { 10 call void @can_throw() 11 ret i32 0 12 ; CHECK-EXC: define i32 @func1() 13 ; CHECK-EXC: call void @__tsan_func_entry 14 ; CHECK-EXC: invoke void @can_throw() 15 ; CHECK-EXC: .noexc: 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() 20 ; CHECK-EXC: resume 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 26} 27 28define i32 @func2() sanitize_thread { 29 call void @cannot_throw() 30 ret i32 0 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() 35 ; CHECK: ret i32 0 36} 37 38define i32 @func3(i32* %p) sanitize_thread { 39 %a = load i32, i32* %p 40 ret i32 %a 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() 46 ; CHECK: ret i32 %a 47} 48 49define i32 @func4() sanitize_thread nounwind { 50 call void @can_throw() 51 ret i32 0 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() 56 ; CHECK: ret i32 0 57} 58