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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=instruction-flags --test FileCheck --test-arg --check-prefixes=INTERESTING,CHECK --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck -check-prefixes=RESULT,CHECK %s < %t
; CHECK-LABEL: @add_nuw_nsw_none(
; INTERESTING: = add
; RESULT: add i32
define i32 @add_nuw_nsw_none(i32 %a, i32 %b) {
%op = add nuw nsw i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @add_nuw_nsw_keep_nuw(
; INTERESTING: nuw
; RESULT: add nuw i32
define i32 @add_nuw_nsw_keep_nuw(i32 %a, i32 %b) {
%op = add nuw nsw i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @add_nuw_nsw_keep_nsw(
; INTERESTING: nuw
; RESULT: add nuw i32
define i32 @add_nuw_nsw_keep_nsw(i32 %a, i32 %b) {
%op = add nuw nsw i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @add_nuw_keep_nuw(
; INTERESTING: nuw
; RESULT: add nuw i32
define i32 @add_nuw_keep_nuw(i32 %a, i32 %b) {
%op = add nuw i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @add_nsw_keep_nsw(
; INTERESTING: nsw
; RESULT: add nsw i32
define i32 @add_nsw_keep_nsw(i32 %a, i32 %b) {
%op = add nsw i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @ashr_exact_drop(
; INTERESTING: = ashr
; RESULT: ashr i32
define i32 @ashr_exact_drop(i32 %a, i32 %b) {
%op = ashr exact i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @ashr_exact_keep(
; INTERESTING: exact
; RESULT: ashr exact i32
define i32 @ashr_exact_keep(i32 %a, i32 %b) {
%op = ashr exact i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @getelementptr_inbounds_nuw_drop_both(
; INTERESTING: getelementptr
; RESULT: getelementptr i32, ptr %a, i64 %b
define ptr @getelementptr_inbounds_nuw_drop_both(ptr %a, i64 %b) {
%op = getelementptr inbounds nuw i32, ptr %a, i64 %b
ret ptr %op
}
; CHECK-LABEL: @getelementptr_inbounds_keep_only_inbounds(
; INTERESTING: inbounds
; RESULT: getelementptr inbounds i32, ptr %a, i64 %b
define ptr @getelementptr_inbounds_keep_only_inbounds(ptr %a, i64 %b) {
%op = getelementptr inbounds nuw i32, ptr %a, i64 %b
ret ptr %op
}
; CHECK-LABEL: @getelementptr_inbounds_relax_to_nusw(
; INTERESTING: getelementptr {{inbounds|nusw}}
; RESULT: getelementptr nusw i32, ptr %a, i64 %b
define ptr @getelementptr_inbounds_relax_to_nusw(ptr %a, i64 %b) {
%op = getelementptr inbounds i32, ptr %a, i64 %b
ret ptr %op
}
; CHECK-LABEL: @fadd_reassoc_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_reassoc_none(float %a, float %b) {
%op = fadd reassoc float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_reassoc_keep(
; INTERESTING: fadd reassoc
; RESULT: fadd reassoc float
define float @fadd_reassoc_keep(float %a, float %b) {
%op = fadd reassoc float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_nnan_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_nnan_none(float %a, float %b) {
%op = fadd nnan float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_nnan_keep(
; INTERESTING: fadd nnan
; RESULT: fadd nnan float
define float @fadd_nnan_keep(float %a, float %b) {
%op = fadd nnan float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_ninf_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_ninf_none(float %a, float %b) {
%op = fadd ninf float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_ninf_keep(
; INTERESTING: fadd ninf
; RESULT: fadd ninf float
define float @fadd_ninf_keep(float %a, float %b) {
%op = fadd ninf float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_nsz_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_nsz_none(float %a, float %b) {
%op = fadd nsz float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_nsz_keep(
; INTERESTING: fadd nsz
; RESULT: fadd nsz float
define float @fadd_nsz_keep(float %a, float %b) {
%op = fadd nsz float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_arcp_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_arcp_none(float %a, float %b) {
%op = fadd arcp float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_arcp_keep(
; INTERESTING: fadd arcp
; RESULT: fadd arcp float
define float @fadd_arcp_keep(float %a, float %b) {
%op = fadd arcp float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_contract_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_contract_none(float %a, float %b) {
%op = fadd contract float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_contract_keep(
; INTERESTING: fadd contract
; RESULT: fadd contract float
define float @fadd_contract_keep(float %a, float %b) {
%op = fadd contract float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_afn_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_afn_none(float %a, float %b) {
%op = fadd afn float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_afn_keep(
; INTERESTING: fadd afn
; RESULT: fadd afn float
define float @fadd_afn_keep(float %a, float %b) {
%op = fadd afn float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_fast_none(
; INTERESTING: = fadd
; RESULT: fadd float
define float @fadd_fast_none(float %a, float %b) {
%op = fadd fast float %a, %b
ret float %op
}
; CHECK-LABEL: @fadd_nnan_ninf_keep_nnan(
; INTERESTING: nnan
; RESULT: fadd nnan float
define float @fadd_nnan_ninf_keep_nnan(float %a, float %b) {
%op = fadd nnan ninf float %a, %b
ret float %op
}
; CHECK-LABEL: @zext_nneg_drop(
; INTERESTING: = zext
; RESULT: zext i32
define i64 @zext_nneg_drop(i32 %a) {
%op = zext nneg i32 %a to i64
ret i64 %op
}
; CHECK-LABEL: @zext_nneg_keep(
; INTERESTING: = zext nneg
; RESULT: zext nneg i32
define i64 @zext_nneg_keep(i32 %a) {
%op = zext nneg i32 %a to i64
ret i64 %op
}
; CHECK-LABEL: @or_disjoint_drop(
; INTERESTING: = or
; RESULT: or i32
define i32 @or_disjoint_drop(i32 %a, i32 %b) {
%op = or disjoint i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @or_disjoint_keep(
; INTERESTING: = or disjoint
; RESULT: or disjoint i32
define i32 @or_disjoint_keep(i32 %a, i32 %b) {
%op = or disjoint i32 %a, %b
ret i32 %op
}
; CHECK-LABEL: @trunc_nuw_drop(
; INTERESTING: = trunc
; RESULT: trunc i64
define i32 @trunc_nuw_drop(i64 %a) {
%op = trunc nuw i64 %a to i32
ret i32 %op
}
; CHECK-LABEL: @trunc_nuw_keep(
; INTERESTING: = trunc nuw
; RESULT: trunc nuw i64
define i32 @trunc_nuw_keep(i64 %a) {
%op = trunc nuw i64 %a to i32
ret i32 %op
}
; CHECK-LABEL: @trunc_nsw_drop(
; INTERESTING: = trunc
; RESULT: trunc i64
define i32 @trunc_nsw_drop(i64 %a) {
%op = trunc nsw i64 %a to i32
ret i32 %op
}
; CHECK-LABEL: @trunc_nsw_keep(
; INTERESTING: = trunc nsw
; RESULT: trunc nsw i64
define i32 @trunc_nsw_keep(i64 %a) {
%op = trunc nsw i64 %a to i32
ret i32 %op
}
; CHECK-LABEL: @icmp_samesign_drop(
; INTERESTING: = icmp
; RESULT: icmp ult i32
define i1 @icmp_samesign_drop(i32 %a) {
%op = icmp samesign ult i32 %a, 10
ret i1 %op
}
; CHECK-LABEL: @icmp_samesign_keep(
; INTERESTING: = icmp samesign
; RESULT: icmp samesign ult i32
define i1 @icmp_samesign_keep(i32 %a) {
%op = icmp samesign ult i32 %a, 10
ret i1 %op
}
|