1 ; RUN: opt < %s -S -msan-kernel=1 -passes=msan 2>&1 | FileCheck %s
3 target datalayout = "e-m:e-i64:64-n32:64"
4 target triple = "powerpc64le--linux"
6 define void @Store1(ptr %p, i8 %x) sanitize_memory {
12 ; CHECK-LABEL: define {{[^@]+}}@Store1(
13 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_store_1(ptr %p)
14 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
15 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
16 ; CHECK: store i8 {{.+}}, ptr [[SHADOW]]
19 define void @Store2(ptr %p, i16 %x) sanitize_memory {
25 ; CHECK-LABEL: define {{[^@]+}}@Store2(
26 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_store_2(ptr %p)
27 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
28 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
29 ; CHECK: store i16 {{.+}}, ptr [[SHADOW]]
32 define void @Store4(ptr %p, i32 %x) sanitize_memory {
38 ; CHECK-LABEL: define {{[^@]+}}@Store4(
39 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_store_4(ptr %p)
40 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
41 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
42 ; CHECK: store i32 {{.+}}, ptr [[SHADOW]]
45 define void @Store8(ptr %p, i64 %x) sanitize_memory {
51 ; CHECK-LABEL: define {{[^@]+}}@Store8(
52 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_store_8(ptr %p)
53 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
54 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
55 ; CHECK: store i64 {{.+}}, ptr [[SHADOW]]
58 define void @Store16(ptr %p, i128 %x) sanitize_memory {
64 ; CHECK-LABEL: define {{[^@]+}}@Store16(
65 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_store_n(ptr %p, i64 16)
66 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
67 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
68 ; CHECK: store i128 {{.+}}, ptr [[SHADOW]]
71 define i8 @Load1(ptr %p) sanitize_memory {
77 ; CHECK-LABEL: define {{[^@]+}}@Load1(
78 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_load_1(ptr %p)
79 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
80 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
81 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i8, ptr [[SHADOW]]
82 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
83 ; CHECK: store i8 [[SHADOW_VAL]], ptr %retval_shadow
84 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
85 ; CHECK: ret i8 {{.+}}
87 define i16 @Load2(ptr %p) sanitize_memory {
93 ; CHECK-LABEL: define {{[^@]+}}@Load2(
94 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_load_2(ptr %p)
95 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
96 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
97 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i16, ptr [[SHADOW]]
98 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
99 ; CHECK: store i16 [[SHADOW_VAL]], ptr %retval_shadow
100 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
101 ; CHECK: ret i16 {{.+}}
103 define i32 @Load4(ptr %p) sanitize_memory {
105 %0 = load i32, ptr %p
109 ; CHECK-LABEL: define {{[^@]+}}@Load4(
110 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_load_4(ptr %p)
111 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
112 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
113 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i32, ptr [[SHADOW]]
114 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
115 ; CHECK: store i32 [[SHADOW_VAL]], ptr %retval_shadow
116 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
117 ; CHECK: ret i32 {{.+}}
119 define i64 @Load8(ptr %p) sanitize_memory {
121 %0 = load i64, ptr %p
125 ; CHECK-LABEL: define {{[^@]+}}@Load8(
126 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_load_8(ptr %p)
127 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
128 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
129 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i64, ptr [[SHADOW]]
130 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
131 ; CHECK: store i64 [[SHADOW_VAL]], ptr %retval_shadow
132 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
133 ; CHECK: ret i64 {{.+}}
135 define i128 @Load16(ptr %p) sanitize_memory {
137 %0 = load i128, ptr %p
141 ; CHECK-LABEL: define {{[^@]+}}@Load16(
142 ; CHECK: [[META:%[a-z0-9_]+]] = call { ptr, ptr } @__msan_metadata_ptr_for_load_n(ptr %p, i64 16)
143 ; CHECK: [[SHADOW:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 0
144 ; CHECK: [[ORIGIN:%[a-z0-9_]+]] = extractvalue { ptr, ptr } [[META]], 1
145 ; CHECK: [[SHADOW_VAL:%[a-z0-9_]+]] = load i128, ptr [[SHADOW]]
146 ; CHECK: [[ORIGIN_VAL:%[a-z0-9_]+]] = load i32, ptr [[ORIGIN]]
147 ; CHECK: store i128 [[SHADOW_VAL]], ptr %retval_shadow
148 ; CHECK: store i32 [[ORIGIN_VAL]], ptr %retval_origin
149 ; CHECK: ret i128 {{.+}}