1 ; 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
2 ; RUN: FileCheck -check-prefixes=RESULT,CHECK %s < %t
4 ; CHECK-LABEL: @add_nuw_nsw_none(
7 define i32 @add_nuw_nsw_none(i32 %a, i32 %b) {
8 %op = add nuw nsw i32 %a, %b
12 ; CHECK-LABEL: @add_nuw_nsw_keep_nuw(
15 define i32 @add_nuw_nsw_keep_nuw(i32 %a, i32 %b) {
16 %op = add nuw nsw i32 %a, %b
20 ; CHECK-LABEL: @add_nuw_nsw_keep_nsw(
23 define i32 @add_nuw_nsw_keep_nsw(i32 %a, i32 %b) {
24 %op = add nuw nsw i32 %a, %b
28 ; CHECK-LABEL: @add_nuw_keep_nuw(
31 define i32 @add_nuw_keep_nuw(i32 %a, i32 %b) {
32 %op = add nuw i32 %a, %b
36 ; CHECK-LABEL: @add_nsw_keep_nsw(
39 define i32 @add_nsw_keep_nsw(i32 %a, i32 %b) {
40 %op = add nsw i32 %a, %b
44 ; CHECK-LABEL: @ashr_exact_drop(
47 define i32 @ashr_exact_drop(i32 %a, i32 %b) {
48 %op = ashr exact i32 %a, %b
52 ; CHECK-LABEL: @ashr_exact_keep(
54 ; RESULT: ashr exact i32
55 define i32 @ashr_exact_keep(i32 %a, i32 %b) {
56 %op = ashr exact i32 %a, %b
60 ; CHECK-LABEL: @getelementptr_inbounds_nuw_drop_both(
61 ; INTERESTING: getelementptr
62 ; RESULT: getelementptr i32, ptr %a, i64 %b
63 define ptr @getelementptr_inbounds_nuw_drop_both(ptr %a, i64 %b) {
64 %op = getelementptr inbounds nuw i32, ptr %a, i64 %b
68 ; CHECK-LABEL: @getelementptr_inbounds_keep_only_inbounds(
69 ; INTERESTING: inbounds
70 ; RESULT: getelementptr inbounds i32, ptr %a, i64 %b
71 define ptr @getelementptr_inbounds_keep_only_inbounds(ptr %a, i64 %b) {
72 %op = getelementptr inbounds nuw i32, ptr %a, i64 %b
76 ; CHECK-LABEL: @getelementptr_inbounds_relax_to_nusw(
77 ; INTERESTING: getelementptr {{inbounds|nusw}}
78 ; RESULT: getelementptr nusw i32, ptr %a, i64 %b
79 define ptr @getelementptr_inbounds_relax_to_nusw(ptr %a, i64 %b) {
80 %op = getelementptr inbounds i32, ptr %a, i64 %b
84 ; CHECK-LABEL: @fadd_reassoc_none(
87 define float @fadd_reassoc_none(float %a, float %b) {
88 %op = fadd reassoc float %a, %b
92 ; CHECK-LABEL: @fadd_reassoc_keep(
93 ; INTERESTING: fadd reassoc
94 ; RESULT: fadd reassoc float
95 define float @fadd_reassoc_keep(float %a, float %b) {
96 %op = fadd reassoc float %a, %b
100 ; CHECK-LABEL: @fadd_nnan_none(
101 ; INTERESTING: = fadd
103 define float @fadd_nnan_none(float %a, float %b) {
104 %op = fadd nnan float %a, %b
108 ; CHECK-LABEL: @fadd_nnan_keep(
109 ; INTERESTING: fadd nnan
110 ; RESULT: fadd nnan float
111 define float @fadd_nnan_keep(float %a, float %b) {
112 %op = fadd nnan float %a, %b
116 ; CHECK-LABEL: @fadd_ninf_none(
117 ; INTERESTING: = fadd
119 define float @fadd_ninf_none(float %a, float %b) {
120 %op = fadd ninf float %a, %b
124 ; CHECK-LABEL: @fadd_ninf_keep(
125 ; INTERESTING: fadd ninf
126 ; RESULT: fadd ninf float
127 define float @fadd_ninf_keep(float %a, float %b) {
128 %op = fadd ninf float %a, %b
132 ; CHECK-LABEL: @fadd_nsz_none(
133 ; INTERESTING: = fadd
135 define float @fadd_nsz_none(float %a, float %b) {
136 %op = fadd nsz float %a, %b
140 ; CHECK-LABEL: @fadd_nsz_keep(
141 ; INTERESTING: fadd nsz
142 ; RESULT: fadd nsz float
143 define float @fadd_nsz_keep(float %a, float %b) {
144 %op = fadd nsz float %a, %b
148 ; CHECK-LABEL: @fadd_arcp_none(
149 ; INTERESTING: = fadd
151 define float @fadd_arcp_none(float %a, float %b) {
152 %op = fadd arcp float %a, %b
156 ; CHECK-LABEL: @fadd_arcp_keep(
157 ; INTERESTING: fadd arcp
158 ; RESULT: fadd arcp float
159 define float @fadd_arcp_keep(float %a, float %b) {
160 %op = fadd arcp float %a, %b
164 ; CHECK-LABEL: @fadd_contract_none(
165 ; INTERESTING: = fadd
167 define float @fadd_contract_none(float %a, float %b) {
168 %op = fadd contract float %a, %b
172 ; CHECK-LABEL: @fadd_contract_keep(
173 ; INTERESTING: fadd contract
174 ; RESULT: fadd contract float
175 define float @fadd_contract_keep(float %a, float %b) {
176 %op = fadd contract float %a, %b
180 ; CHECK-LABEL: @fadd_afn_none(
181 ; INTERESTING: = fadd
183 define float @fadd_afn_none(float %a, float %b) {
184 %op = fadd afn float %a, %b
188 ; CHECK-LABEL: @fadd_afn_keep(
189 ; INTERESTING: fadd afn
190 ; RESULT: fadd afn float
191 define float @fadd_afn_keep(float %a, float %b) {
192 %op = fadd afn float %a, %b
196 ; CHECK-LABEL: @fadd_fast_none(
197 ; INTERESTING: = fadd
199 define float @fadd_fast_none(float %a, float %b) {
200 %op = fadd fast float %a, %b
204 ; CHECK-LABEL: @fadd_nnan_ninf_keep_nnan(
206 ; RESULT: fadd nnan float
207 define float @fadd_nnan_ninf_keep_nnan(float %a, float %b) {
208 %op = fadd nnan ninf float %a, %b
212 ; CHECK-LABEL: @zext_nneg_drop(
213 ; INTERESTING: = zext
215 define i64 @zext_nneg_drop(i32 %a) {
216 %op = zext nneg i32 %a to i64
220 ; CHECK-LABEL: @zext_nneg_keep(
221 ; INTERESTING: = zext nneg
222 ; RESULT: zext nneg i32
223 define i64 @zext_nneg_keep(i32 %a) {
224 %op = zext nneg i32 %a to i64
228 ; CHECK-LABEL: @or_disjoint_drop(
231 define i32 @or_disjoint_drop(i32 %a, i32 %b) {
232 %op = or disjoint i32 %a, %b
236 ; CHECK-LABEL: @or_disjoint_keep(
237 ; INTERESTING: = or disjoint
238 ; RESULT: or disjoint i32
239 define i32 @or_disjoint_keep(i32 %a, i32 %b) {
240 %op = or disjoint i32 %a, %b
244 ; CHECK-LABEL: @trunc_nuw_drop(
245 ; INTERESTING: = trunc
247 define i32 @trunc_nuw_drop(i64 %a) {
248 %op = trunc nuw i64 %a to i32
252 ; CHECK-LABEL: @trunc_nuw_keep(
253 ; INTERESTING: = trunc nuw
254 ; RESULT: trunc nuw i64
255 define i32 @trunc_nuw_keep(i64 %a) {
256 %op = trunc nuw i64 %a to i32
260 ; CHECK-LABEL: @trunc_nsw_drop(
261 ; INTERESTING: = trunc
263 define i32 @trunc_nsw_drop(i64 %a) {
264 %op = trunc nsw i64 %a to i32
268 ; CHECK-LABEL: @trunc_nsw_keep(
269 ; INTERESTING: = trunc nsw
270 ; RESULT: trunc nsw i64
271 define i32 @trunc_nsw_keep(i64 %a) {
272 %op = trunc nsw i64 %a to i32
276 ; CHECK-LABEL: @icmp_samesign_drop(
277 ; INTERESTING: = icmp
278 ; RESULT: icmp ult i32
279 define i1 @icmp_samesign_drop(i32 %a) {
280 %op = icmp samesign ult i32 %a, 10
284 ; CHECK-LABEL: @icmp_samesign_keep(
285 ; INTERESTING: = icmp samesign
286 ; RESULT: icmp samesign ult i32
287 define i1 @icmp_samesign_keep(i32 %a) {
288 %op = icmp samesign ult i32 %a, 10