1 ; RUN: opt -simplifycfg -S %s | FileCheck %s
2 ; Make sure we don't speculate loads under ThreadSanitizer.
3 @g = global i32 0, align 4
5 define i32 @TestNoTsan(i32 %cond) nounwind readonly uwtable {
7 %tobool = icmp eq i32 %cond, 0
8 br i1 %tobool, label %return, label %if.then
10 if.then: ; preds = %entry
11 %0 = load i32, i32* @g, align 4
14 return: ; preds = %entry, %if.then
15 %retval = phi i32 [ %0, %if.then ], [ 0, %entry ]
17 ; CHECK-LABEL: @TestNoTsan
18 ; CHECK: %[[LOAD:[^ ]*]] = load
19 ; CHECK: select{{.*}}[[LOAD]]
23 define i32 @TestTsan(i32 %cond) nounwind readonly uwtable sanitize_thread {
25 %tobool = icmp eq i32 %cond, 0
26 br i1 %tobool, label %return, label %if.then
28 if.then: ; preds = %entry
29 %0 = load i32, i32* @g, align 4
32 return: ; preds = %entry, %if.then
33 %retval = phi i32 [ %0, %if.then ], [ 0, %entry ]
35 ; CHECK-LABEL: @TestTsan
37 ; CHECK: load i32, i32* @g