1 ; RUN: opt -simplifycfg -S %s | FileCheck %s
2 ; Make sure we don't speculate loads under AddressSanitizer.
3 @g = global i32 0, align 4
5 define i32 @TestNoAsan(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: @TestNoAsan
18 ; CHECK: %[[LOAD:[^ ]*]] = load
19 ; CHECK: select{{.*}}[[LOAD]]
23 define i32 @TestAsan(i32 %cond) nounwind readonly uwtable sanitize_address {
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: @TestAsan
37 ; CHECK: load i32, i32* @g
42 define i32 @TestHWAsan(i32 %cond) nounwind readonly uwtable sanitize_hwaddress {
44 %tobool = icmp eq i32 %cond, 0
45 br i1 %tobool, label %return, label %if.then
47 if.then: ; preds = %entry
48 %0 = load i32, i32* @g, align 4
51 return: ; preds = %entry, %if.then
52 %retval = phi i32 [ %0, %if.then ], [ 0, %entry ]
54 ; CHECK-LABEL: @TestHWAsan
56 ; CHECK: load i32, i32* @g