1 ; RUN: opt < %s -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(i32*)
7 @sink = global i32* null, align 4
9 define void @captured0() nounwind uwtable sanitize_thread {
11 %ptr = alloca i32, align 4
13 call void @escape(i32* %ptr)
14 store i32 42, i32* %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 i32* %ptr, i32** @sink, align 8
26 store i32 42, i32* %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 i32*, align 8
39 store i32* %ptr, i32** %tmp, align 8
40 %0 = load i32*, i32** %tmp, align 8
41 store i32* %0, i32** @sink, align 8
42 store i32 42, i32* %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, i32* %ptr, align 4
55 call void @escape(i32* %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, i32* %ptr, align 4
66 ; escapes due to store into global
67 store i32* %ptr, i32** @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 i32*, align 8
79 store i32 42, i32* %ptr, align 4
81 store i32* %ptr, i32** %tmp, align 8
82 %0 = load i32*, i32** %tmp, align 8
83 store i32* %0, i32** @sink, align 8
86 ; CHECK-LABEL: define void @notcaptured2