1 ; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
7 ; Test origin for longer stores.
9 define void @Store8(ptr nocapture %p, i64 %x) sanitize_memory {
11 store i64 %x, ptr %p, align 8
15 ; Single 8-byte origin store
16 ; CHECK-LABEL: define void @Store8(
17 ; CHECK: store i64 {{.*}}, align 8
18 ; CHECK: store i64 {{.*}}, align 8
19 ; CHECK: store i64 {{.*}}, align 8
22 define void @Store8_align4(ptr nocapture %p, i64 %x) sanitize_memory {
24 store i64 %x, ptr %p, align 4
28 ; Two 4-byte origin stores
29 ; CHECK-LABEL: define void @Store8_align4(
30 ; CHECK: store i64 {{.*}}, align 4
31 ; CHECK: store i32 {{.*}}, align 4
32 ; CHECK: getelementptr i32, ptr {{.*}}, i32 1
33 ; CHECK: store i32 {{.*}}, align 4
34 ; CHECK: store i64 {{.*}}, align 4
37 %struct.S = type { i32, i32, i32 }
39 define void @StoreAgg(ptr nocapture %p, %struct.S %x) sanitize_memory {
41 store %struct.S %x, ptr %p, align 4
45 ; Three 4-byte origin stores
46 ; CHECK-LABEL: define void @StoreAgg(
47 ; CHECK: store { i32, i32, i32 } {{.*}}, align 4
48 ; CHECK: store i32 {{.*}}, align 4
49 ; CHECK: getelementptr i32, ptr {{.*}}, i32 1
50 ; CHECK: store i32 {{.*}}, align 4
51 ; CHECK: getelementptr i32, ptr {{.*}}, i32 2
52 ; CHECK: store i32 {{.*}}, align 4
53 ; CHECK: store %struct.S {{.*}}, align 4
57 define void @StoreAgg8(ptr nocapture %p, %struct.S %x) sanitize_memory {
59 store %struct.S %x, ptr %p, align 8
63 ; 8-byte + 4-byte origin stores
64 ; CHECK-LABEL: define void @StoreAgg8(
65 ; CHECK: store { i32, i32, i32 } {{.*}}, align 8
66 ; CHECK: store i64 {{.*}}, align 8
67 ; CHECK: getelementptr i32, ptr {{.*}}, i32 2
68 ; CHECK: store i32 {{.*}}, align 8
69 ; CHECK: store %struct.S {{.*}}, align 8
73 %struct.Q = type { i64, i64, i64 }
74 define void @StoreAgg24(ptr nocapture %p, %struct.Q %x) sanitize_memory {
76 store %struct.Q %x, ptr %p, align 8
80 ; 3 8-byte origin stores
81 ; CHECK-LABEL: define void @StoreAgg24(
82 ; CHECK: store { i64, i64, i64 } {{.*}}, align 8
83 ; CHECK: store i64 {{.*}}, align 8
84 ; CHECK: getelementptr i64, ptr {{.*}}, i32 1
85 ; CHECK: store i64 {{.*}}, align 8
86 ; CHECK: getelementptr i64, ptr {{.*}}, i32 2
87 ; CHECK: store i64 {{.*}}, align 8
88 ; CHECK: store %struct.Q {{.*}}, align 8