aboutsummaryrefslogtreecommitdiffstats
path: root/test/Instrumentation/DataFlowSanitizer/store.ll
blob: 365b62d9e1071d3f094d377db55ceaf32faa74a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
; RUN: opt < %s -dfsan -dfsan-combine-pointer-labels-on-store=1 -S | FileCheck %s --check-prefix=COMBINE_PTR_LABEL
; RUN: opt < %s -dfsan -dfsan-combine-pointer-labels-on-store=0 -S | FileCheck %s --check-prefix=NO_COMBINE_PTR_LABEL
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"
target triple = "x86_64-unknown-linux-gnu"

define void @store0({} %v, {}* %p) {
  ; COMBINE_PTR_LABEL: @"dfs$store0"
  ; COMBINE_PTR_LABEL: store
  ; COMBINE_PTR_LABEL-NOT: store

  ; NO_COMBINE_PTR_LABEL: @"dfs$store0"
  ; NO_COMBINE_PTR_LABEL: store
  ; NO_COMBINE_PTR_LABEL-NOT: store

  store {} %v, {}* %p
  ret void
}

define void @store8(i8 %v, i8* %p) {
  ; NO_COMBINE_PTR_LABEL: @"dfs$store8"
  ; NO_COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; NO_COMBINE_PTR_LABEL: ptrtoint i8* {{.*}} i64
  ; NO_COMBINE_PTR_LABEL: and i64
  ; NO_COMBINE_PTR_LABEL: mul i64
  ; NO_COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: store i8

  ; COMBINE_PTR_LABEL: @"dfs$store8"
  ; COMBINE_PTR_LABEL: load i16*
  ; COMBINE_PTR_LABEL: load i16*
  ; COMBINE_PTR_LABEL: icmp ne i16
  ; COMBINE_PTR_LABEL: call {{.*}} @__dfsan_union
  ; COMBINE_PTR_LABEL: ptrtoint i8* {{.*}} i64
  ; COMBINE_PTR_LABEL: and i64
  ; COMBINE_PTR_LABEL: mul i64
  ; COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: store i8

  store i8 %v, i8* %p
  ret void
}

define void @store16(i16 %v, i16* %p) {
  ; NO_COMBINE_PTR_LABEL: @"dfs$store16"
  ; NO_COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; NO_COMBINE_PTR_LABEL: ptrtoint i16* {{.*}} i64
  ; NO_COMBINE_PTR_LABEL: and i64
  ; NO_COMBINE_PTR_LABEL: mul i64
  ; NO_COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: store i16

  ; COMBINE_PTR_LABEL: @"dfs$store16"
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: icmp ne i16
  ; COMBINE_PTR_LABEL: call {{.*}} @__dfsan_union
  ; COMBINE_PTR_LABEL: ptrtoint i16* {{.*}} i64
  ; COMBINE_PTR_LABEL: and i64
  ; COMBINE_PTR_LABEL: mul i64
  ; COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: store i16

  store i16 %v, i16* %p
  ret void
}

define void @store32(i32 %v, i32* %p) {
  ; NO_COMBINE_PTR_LABEL: @"dfs$store32"
  ; NO_COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; NO_COMBINE_PTR_LABEL: ptrtoint i32* {{.*}} i64
  ; NO_COMBINE_PTR_LABEL: and i64
  ; NO_COMBINE_PTR_LABEL: mul i64
  ; NO_COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: getelementptr i16*
  ; NO_COMBINE_PTR_LABEL: store i16
  ; NO_COMBINE_PTR_LABEL: store i32

  ; COMBINE_PTR_LABEL: @"dfs$store32"
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: icmp ne i16
  ; COMBINE_PTR_LABEL: call {{.*}} @__dfsan_union
  ; COMBINE_PTR_LABEL: ptrtoint i32* {{.*}} i64
  ; COMBINE_PTR_LABEL: and i64
  ; COMBINE_PTR_LABEL: mul i64
  ; COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: getelementptr i16*
  ; COMBINE_PTR_LABEL: store i16
  ; COMBINE_PTR_LABEL: store i32

  store i32 %v, i32* %p
  ret void
}

define void @store64(i64 %v, i64* %p) {
  ; NO_COMBINE_PTR_LABEL: @"dfs$store64"
  ; NO_COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; NO_COMBINE_PTR_LABEL: ptrtoint i64* {{.*}} i64
  ; NO_COMBINE_PTR_LABEL: and i64
  ; NO_COMBINE_PTR_LABEL: mul i64
  ; NO_COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; NO_COMBINE_PTR_LABEL: bitcast i16* {{.*}} <8 x i16>*
  ; NO_COMBINE_PTR_LABEL: store i64

  ; COMBINE_PTR_LABEL: @"dfs$store64"
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: load i16* {{.*}} @__dfsan_arg_tls
  ; COMBINE_PTR_LABEL: icmp ne i16
  ; COMBINE_PTR_LABEL: call {{.*}} @__dfsan_union
  ; COMBINE_PTR_LABEL: ptrtoint i64* {{.*}} i64
  ; COMBINE_PTR_LABEL: and i64
  ; COMBINE_PTR_LABEL: mul i64
  ; COMBINE_PTR_LABEL: inttoptr i64 {{.*}} i16*
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: insertelement {{.*}} i16
  ; COMBINE_PTR_LABEL: bitcast i16* {{.*}} <8 x i16>*
  ; COMBINE_PTR_LABEL: store <8 x i16>
  ; COMBINE_PTR_LABEL: store i64

  store i64 %v, i64* %p
  ret void
}