2 ; RUN: opt < %s -passes=asan -S | FileCheck %s --check-prefixes=CHECK-ALIAS,CHECK-INDICATOR
4 ; {newPM,legacyPM} x {alias0,alias1} x {odr0,odr1}
5 ; RUN: opt < %s -passes=asan -asan-use-private-alias=0 -asan-use-odr-indicator=0 -S | FileCheck %s --check-prefixes=CHECK-NOALIAS,CHECK-NOINDICATOR
6 ; RUN: opt < %s -passes=asan -asan-use-private-alias=1 -asan-use-odr-indicator=0 -S | FileCheck %s --check-prefixes=CHECK-ALIAS,CHECK-NOINDICATOR
7 ; RUN: opt < %s -passes=asan -asan-use-private-alias=0 -asan-use-odr-indicator=1 -S | FileCheck %s --check-prefixes=CHECK-NOALIAS,CHECK-INDICATOR
8 ; RUN: opt < %s -passes=asan -asan-use-private-alias=1 -asan-use-odr-indicator=1 -S | FileCheck %s --check-prefixes=CHECK-ALIAS,CHECK-INDICATOR
10 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11 target triple = "x86_64-unknown-linux-gnu"
13 @a = dso_local global [2 x i32] zeroinitializer, align 4
14 @b = private global [2 x i32] zeroinitializer, align 4
15 @c = internal global [2 x i32] zeroinitializer, align 4
16 @_ZL1d = unnamed_addr global [2 x i32] zeroinitializer, align 4
18 ; Check that we generate internal alias and odr indicator symbols for global to be protected.
19 ; CHECK-NOINDICATOR-NOT: __odr_asan_gen_a
20 ; CHECK-NOALIAS-NOT: private alias
21 ; CHECK-INDICATOR: @___asan_gen_.1 = private unnamed_addr constant [2 x i8] c"a\00", align 1
22 ; CHECK-INDICATOR: @__odr_asan_gen_a = global i8 0, align 1
23 ; CHECK-INDICATOR: @___asan_gen_.4 = private unnamed_addr constant [2 x i8] c"d\00", align 1
24 ; CHECK-INDICATOR: @__odr_asan_gen__ZL1d = global i8 0, align 1
25 ; CHECK-ALIAS: @0 = private alias { [2 x i32], [24 x i8] }, ptr @a
27 ; CHECK-ALIAS: @1 = private alias { [2 x i32], [24 x i8] }, ptr @b
28 ; CHECK-ALIAS: @2 = private alias { [2 x i32], [24 x i8] }, ptr @c
29 ; CHECK-ALIAS: @3 = private alias { [2 x i32], [24 x i8] }, ptr @_ZL1d
31 ; Function Attrs: nounwind sanitize_address uwtable
32 define i32 @foo(i32 %M) #0 {
34 %M.addr = alloca i32, align 4
35 store i32 %M, ptr %M.addr, align 4
36 store volatile i32 6, ptr getelementptr inbounds ([2 x i32], ptr @a, i64 2, i64 0), align 4
37 %0 = load i32, ptr %M.addr, align 4
38 %idxprom = sext i32 %0 to i64
39 %arrayidx = getelementptr inbounds [2 x i32], ptr @a, i64 0, i64 %idxprom
40 %1 = load volatile i32, ptr %arrayidx, align 4