• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -tsan -S | FileCheck %s
2
3target 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"
4
5define void @IncrementMe(i32* nocapture %ptr) nounwind uwtable sanitize_thread {
6entry:
7  %0 = load i32, i32* %ptr, align 4
8  %inc = add nsw i32 %0, 1
9  store i32 %inc, i32* %ptr, align 4
10  ret void
11}
12; CHECK: define void @IncrementMe
13; CHECK-NOT: __tsan_read
14; CHECK: __tsan_write
15; CHECK: ret void
16
17define void @IncrementMeWithCallInBetween(i32* nocapture %ptr) nounwind uwtable sanitize_thread {
18entry:
19  %0 = load i32, i32* %ptr, align 4
20  %inc = add nsw i32 %0, 1
21  call void @foo()
22  store i32 %inc, i32* %ptr, align 4
23  ret void
24}
25
26; CHECK: define void @IncrementMeWithCallInBetween
27; CHECK: __tsan_read
28; CHECK: __tsan_write
29; CHECK: ret void
30
31declare void @foo()
32
33