1 ; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
2 ; RUN: -passes=msan 2>&1 | FileCheck %s
3 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
5 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"
6 target triple = "x86_64-unknown-linux-gnu"
9 ; Test origin for longer stores.
11 define void @Store8(i64* nocapture %p, i64 %x) sanitize_memory {
13 store i64 %x, i64* %p, align 8
17 ; Single 8-byte origin store
18 ; CHECK-LABEL: define void @Store8(
19 ; CHECK: store i64 {{.*}}, align 8
20 ; CHECK: store i64 {{.*}}, align 8
21 ; CHECK: store i64 {{.*}}, align 8
24 define void @Store8_align4(i64* nocapture %p, i64 %x) sanitize_memory {
26 store i64 %x, i64* %p, align 4
30 ; Two 4-byte origin stores
31 ; CHECK-LABEL: define void @Store8_align4(
32 ; CHECK: store i64 {{.*}}, align 4
33 ; CHECK: store i32 {{.*}}, align 4
34 ; CHECK: getelementptr i32, i32* {{.*}}, i32 1
35 ; CHECK: store i32 {{.*}}, align 4
36 ; CHECK: store i64 {{.*}}, align 4
39 %struct.S = type { i32, i32, i32 }
41 define void @StoreAgg(%struct.S* nocapture %p, %struct.S %x) sanitize_memory {
43 store %struct.S %x, %struct.S* %p, align 4
47 ; Three 4-byte origin stores
48 ; CHECK-LABEL: define void @StoreAgg(
49 ; CHECK: store { i32, i32, i32 } {{.*}}, align 4
50 ; CHECK: store i32 {{.*}}, align 4
51 ; CHECK: getelementptr i32, i32* {{.*}}, i32 1
52 ; CHECK: store i32 {{.*}}, align 4
53 ; CHECK: getelementptr i32, i32* {{.*}}, i32 2
54 ; CHECK: store i32 {{.*}}, align 4
55 ; CHECK: store %struct.S {{.*}}, align 4
59 define void @StoreAgg8(%struct.S* nocapture %p, %struct.S %x) sanitize_memory {
61 store %struct.S %x, %struct.S* %p, align 8
65 ; 8-byte + 4-byte origin stores
66 ; CHECK-LABEL: define void @StoreAgg8(
67 ; CHECK: store { i32, i32, i32 } {{.*}}, align 8
68 ; CHECK: store i64 {{.*}}, align 8
69 ; CHECK: getelementptr i32, i32* {{.*}}, i32 2
70 ; CHECK: store i32 {{.*}}, align 8
71 ; CHECK: store %struct.S {{.*}}, align 8
75 %struct.Q = type { i64, i64, i64 }
76 define void @StoreAgg24(%struct.Q* nocapture %p, %struct.Q %x) sanitize_memory {
78 store %struct.Q %x, %struct.Q* %p, align 8
82 ; 3 8-byte origin stores
83 ; CHECK-LABEL: define void @StoreAgg24(
84 ; CHECK: store { i64, i64, i64 } {{.*}}, align 8
85 ; CHECK: store i64 {{.*}}, align 8
86 ; CHECK: getelementptr i64, i64* {{.*}}, i32 1
87 ; CHECK: store i64 {{.*}}, align 8
88 ; CHECK: getelementptr i64, i64* {{.*}}, i32 2
89 ; CHECK: store i64 {{.*}}, align 8
90 ; CHECK: store %struct.Q {{.*}}, align 8