1 ; RUN: opt < %s -passes=tsan -S | FileCheck %s
3 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"
5 declare void @escape(ptr)
7 @sink = global ptr null, align 4
9 define void @captured0() nounwind uwtable sanitize_thread {
11 %ptr = alloca i32, align 4
13 call void @escape(ptr %ptr)
14 store i32 42, ptr %ptr, align 4
17 ; CHECK-LABEL: define void @captured0
21 define void @captured1() nounwind uwtable sanitize_thread {
23 %ptr = alloca i32, align 4
24 ; escapes due to store into global
25 store ptr %ptr, ptr @sink, align 8
26 store i32 42, ptr %ptr, align 4
29 ; CHECK-LABEL: define void @captured1
34 define void @captured2() nounwind uwtable sanitize_thread {
36 %ptr = alloca i32, align 4
37 %tmp = alloca ptr, align 8
39 store ptr %ptr, ptr %tmp, align 8
40 %0 = load ptr, ptr %tmp, align 8
41 store ptr %0, ptr @sink, align 8
42 store i32 42, ptr %ptr, align 4
45 ; CHECK-LABEL: define void @captured2
50 define void @notcaptured0() nounwind uwtable sanitize_thread {
52 %ptr = alloca i32, align 4
53 store i32 42, ptr %ptr, align 4
55 call void @escape(ptr %ptr)
58 ; CHECK-LABEL: define void @notcaptured0
62 define void @notcaptured1() nounwind uwtable sanitize_thread {
64 %ptr = alloca i32, align 4
65 store i32 42, ptr %ptr, align 4
66 ; escapes due to store into global
67 store ptr %ptr, ptr @sink, align 8
70 ; CHECK-LABEL: define void @notcaptured1
75 define void @notcaptured2() nounwind uwtable sanitize_thread {
77 %ptr = alloca i32, align 4
78 %tmp = alloca ptr, align 8
79 store i32 42, ptr %ptr, align 4
81 store ptr %ptr, ptr %tmp, align 8
82 %0 = load ptr, ptr %tmp, align 8
83 store ptr %0, ptr @sink, align 8
86 ; CHECK-LABEL: define void @notcaptured2