1 ; Test that the msan layout customization options work as expected
3 ; RUN: opt < %s -msan-shadow-base 3735928559 -S -passes=msan 2>&1 | FileCheck \
4 ; RUN: --check-prefix=CHECK-BASE %s
5 ; RUN: opt < %s -msan -msan-shadow-base 3735928559 -S | FileCheck --check-prefix=CHECK-BASE %s
6 ; RUN: opt < %s -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S \
7 ; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-AND %s
8 ; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-AND %s
9 ; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S \
10 ; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-XOR %s
11 ; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S | FileCheck --check-prefix=CHECK-XOR %s
12 ; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 \
13 ; RUN: -msan-and-mask 4294901760 -S -passes=msan 2>&1 | FileCheck \
14 ; RUN: --check-prefix=CHECK-XOR-AND %s
15 ; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
16 ; RUN: opt < %s -msan-track-origins 1 -msan-origin-base 1777777 -S -passes=msan\
17 ; RUN: 2>&1 | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
18 ; RUN: opt < %s -msan -msan-track-origins 1 -msan-origin-base 1777777 -S | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
20 target triple = "x86_64-unknown-linux-gnu"
22 define i32 @read_value(i32* %a) sanitize_memory {
24 %tmp1 = load i32, i32* %a, align 4
27 ; CHECK-BASE-LABEL: @read_value
28 ; CHECK-BASE-NOT: ret i32
29 ; CHECK-BASE: add{{.*}}3735928559
32 ; CHECK-AND-LABEL: @read_value
33 ; CHECK-AND-NOT: ret i32
34 ; CHECK-AND: and{{.*}}-4294901761
35 ; CHECK-AND-NEXT: add{{.*}}3735928559
38 ; CHECK-XOR-LABEL: @read_value
39 ; CHECK-XOR-NOT: ret i32
40 ; CHECK-XOR: xor{{.*}}48879
41 ; CHECK-XOR-NEXT: add{{.*}}3735928559
44 ; CHECK-XOR-AND-LABEL: @read_value
45 ; CHECK-XOR-AND-NOT: ret i32
46 ; CHECK-XOR-AND: and{{.*}}-4294901761
47 ; CHECK-XOR-AND-NEXT: xor{{.*}}48879
48 ; CHECK-XOR-AND-NEXT: add{{.*}}3735928559
49 ; CHECK-XOR-AND: ret i32
51 ; CHECK-ORIGIN-BASE-LABEL: @read_value
52 ; CHECK-ORIGIN-BASE-NOT: ret i32
53 ; CHECK-ORIGIN-BASE: add{{.*}}1777777
54 ; CHECK-ORIGIN-BASE: ret i32