llvm.org GIT mirror llvm / e90a517
[PatternMatch] Generalize m_SpecificInt_ULT() to take ICmpInst::Predicate As discussed in the original review, this may be useful, so let's just do it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365652 91177308-0d34-0410-b5e6-96231b3b80d8 Roman Lebedev 1 year, 4 months ago
4 changed file(s) with 419 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
417417 return cst_pred_ty();
418418 }
419419
420 struct is_unsigned_less_than {
420 struct icmp_pred_with_threshold {
421 ICmpInst::Predicate Pred;
421422 const APInt *Thr;
422 bool isValue(const APInt &C) { return C.ult(*Thr); }
423 };
424 /// Match an integer or vector with every element unsigned less than the
425 /// Threshold. For vectors, this includes constants with undefined elements.
426 /// FIXME: is it worth generalizing this to simply take ICmpInst::Predicate?
427 inline cst_pred_ty
428 m_SpecificInt_ULT(const APInt &Threshold) {
429 cst_pred_ty P;
423 bool isValue(const APInt &C) {
424 switch (Pred) {
425 case ICmpInst::Predicate::ICMP_EQ:
426 return C.eq(*Thr);
427 case ICmpInst::Predicate::ICMP_NE:
428 return C.ne(*Thr);
429 case ICmpInst::Predicate::ICMP_UGT:
430 return C.ugt(*Thr);
431 case ICmpInst::Predicate::ICMP_UGE:
432 return C.uge(*Thr);
433 case ICmpInst::Predicate::ICMP_ULT:
434 return C.ult(*Thr);
435 case ICmpInst::Predicate::ICMP_ULE:
436 return C.ule(*Thr);
437 case ICmpInst::Predicate::ICMP_SGT:
438 return C.sgt(*Thr);
439 case ICmpInst::Predicate::ICMP_SGE:
440 return C.sge(*Thr);
441 case ICmpInst::Predicate::ICMP_SLT:
442 return C.slt(*Thr);
443 case ICmpInst::Predicate::ICMP_SLE:
444 return C.sle(*Thr);
445 default:
446 llvm_unreachable("Unhandled ICmp predicate");
447 }
448 }
449 };
450 /// Match an integer or vector with every element comparing 'pred' (eg/ne/...)
451 /// to Threshold. For vectors, this includes constants with undefined elements.
452 inline cst_pred_ty
453 m_SpecificInt_ICMP(ICmpInst::Predicate Predicate, const APInt &Threshold) {
454 cst_pred_ty P;
455 P.Pred = Predicate;
430456 P.Thr = &Threshold;
431457 return P;
432458 }
33153315 // Is the new shift amount smaller than the bit width?
33163316 // FIXME: could also rely on ConstantRange.
33173317 unsigned BitWidth = X->getType()->getScalarSizeInBits();
3318 if (!match(NewShAmt, m_SpecificInt_ULT(APInt(BitWidth, BitWidth))))
3318 if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
3319 APInt(BitWidth, BitWidth))))
33193320 return nullptr;
33203321 // All good, we can do this fold. The shift is the same that was for X.
33213322 Value *T0 = XShiftOpcode == Instruction::BinaryOps::LShr
4747 // Is the new shift amount smaller than the bit width?
4848 // FIXME: could also rely on ConstantRange.
4949 unsigned BitWidth = X->getType()->getScalarSizeInBits();
50 if (!match(NewShAmt, m_SpecificInt_ULT(APInt(BitWidth, BitWidth))))
50 if (!match(NewShAmt, m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT,
51 APInt(BitWidth, BitWidth))))
5152 return nullptr;
5253 // All good, we can do this fold.
5354 BinaryOperator *NewShift = BinaryOperator::Create(ShiftOpcode, X, NewShAmt);
6363 EXPECT_FALSE(m_OneUse(m_Value()).match(Leaf));
6464 }
6565
66 TEST_F(PatternMatchTest, SpecificIntEQ) {
67 Type *IntTy = IRB.getInt32Ty();
68 unsigned BitWidth = IntTy->getScalarSizeInBits();
69
70 Value *Zero = ConstantInt::get(IntTy, 0);
71 Value *One = ConstantInt::get(IntTy, 1);
72 Value *NegOne = ConstantInt::get(IntTy, -1);
73
74 EXPECT_TRUE(
75 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 0))
76 .match(Zero));
77 EXPECT_FALSE(
78 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 0))
79 .match(One));
80 EXPECT_FALSE(
81 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 0))
82 .match(NegOne));
83
84 EXPECT_FALSE(
85 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 1))
86 .match(Zero));
87 EXPECT_TRUE(
88 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 1))
89 .match(One));
90 EXPECT_FALSE(
91 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, 1))
92 .match(NegOne));
93
94 EXPECT_FALSE(
95 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, -1))
96 .match(Zero));
97 EXPECT_FALSE(
98 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, -1))
99 .match(One));
100 EXPECT_TRUE(
101 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_EQ, APInt(BitWidth, -1))
102 .match(NegOne));
103 }
104
105 TEST_F(PatternMatchTest, SpecificIntNE) {
106 Type *IntTy = IRB.getInt32Ty();
107 unsigned BitWidth = IntTy->getScalarSizeInBits();
108
109 Value *Zero = ConstantInt::get(IntTy, 0);
110 Value *One = ConstantInt::get(IntTy, 1);
111 Value *NegOne = ConstantInt::get(IntTy, -1);
112
113 EXPECT_FALSE(
114 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 0))
115 .match(Zero));
116 EXPECT_TRUE(
117 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 0))
118 .match(One));
119 EXPECT_TRUE(
120 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 0))
121 .match(NegOne));
122
123 EXPECT_TRUE(
124 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 1))
125 .match(Zero));
126 EXPECT_FALSE(
127 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 1))
128 .match(One));
129 EXPECT_TRUE(
130 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, 1))
131 .match(NegOne));
132
133 EXPECT_TRUE(
134 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, -1))
135 .match(Zero));
136 EXPECT_TRUE(
137 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, -1))
138 .match(One));
139 EXPECT_FALSE(
140 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_NE, APInt(BitWidth, -1))
141 .match(NegOne));
142 }
143
144 TEST_F(PatternMatchTest, SpecificIntUGT) {
145 Type *IntTy = IRB.getInt32Ty();
146 unsigned BitWidth = IntTy->getScalarSizeInBits();
147
148 Value *Zero = ConstantInt::get(IntTy, 0);
149 Value *One = ConstantInt::get(IntTy, 1);
150 Value *NegOne = ConstantInt::get(IntTy, -1);
151
152 EXPECT_FALSE(
153 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 0))
154 .match(Zero));
155 EXPECT_TRUE(
156 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 0))
157 .match(One));
158 EXPECT_TRUE(
159 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 0))
160 .match(NegOne));
161
162 EXPECT_FALSE(
163 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 1))
164 .match(Zero));
165 EXPECT_FALSE(
166 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 1))
167 .match(One));
168 EXPECT_TRUE(
169 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, 1))
170 .match(NegOne));
171
172 EXPECT_FALSE(
173 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, -1))
174 .match(Zero));
175 EXPECT_FALSE(
176 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, -1))
177 .match(One));
178 EXPECT_FALSE(
179 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGT, APInt(BitWidth, -1))
180 .match(NegOne));
181 }
182
183 TEST_F(PatternMatchTest, SpecificIntUGE) {
184 Type *IntTy = IRB.getInt32Ty();
185 unsigned BitWidth = IntTy->getScalarSizeInBits();
186
187 Value *Zero = ConstantInt::get(IntTy, 0);
188 Value *One = ConstantInt::get(IntTy, 1);
189 Value *NegOne = ConstantInt::get(IntTy, -1);
190
191 EXPECT_TRUE(
192 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 0))
193 .match(Zero));
194 EXPECT_TRUE(
195 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 0))
196 .match(One));
197 EXPECT_TRUE(
198 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 0))
199 .match(NegOne));
200
201 EXPECT_FALSE(
202 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 1))
203 .match(Zero));
204 EXPECT_TRUE(
205 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 1))
206 .match(One));
207 EXPECT_TRUE(
208 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, 1))
209 .match(NegOne));
210
211 EXPECT_FALSE(
212 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, -1))
213 .match(Zero));
214 EXPECT_FALSE(
215 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, -1))
216 .match(One));
217 EXPECT_TRUE(
218 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_UGE, APInt(BitWidth, -1))
219 .match(NegOne));
220 }
221
66222 TEST_F(PatternMatchTest, SpecificIntULT) {
67223 Type *IntTy = IRB.getInt32Ty();
68224 unsigned BitWidth = IntTy->getScalarSizeInBits();
71227 Value *One = ConstantInt::get(IntTy, 1);
72228 Value *NegOne = ConstantInt::get(IntTy, -1);
73229
74 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, 0)).match(Zero));
75 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, 0)).match(One));
76 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, 0)).match(NegOne));
77
78 EXPECT_TRUE(m_SpecificInt_ULT(APInt(BitWidth, 1)).match(Zero));
79 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, 1)).match(One));
80 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, 1)).match(NegOne));
81
82 EXPECT_TRUE(m_SpecificInt_ULT(APInt(BitWidth, -1)).match(Zero));
83 EXPECT_TRUE(m_SpecificInt_ULT(APInt(BitWidth, -1)).match(One));
84 EXPECT_FALSE(m_SpecificInt_ULT(APInt(BitWidth, -1)).match(NegOne));
230 EXPECT_FALSE(
231 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 0))
232 .match(Zero));
233 EXPECT_FALSE(
234 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 0))
235 .match(One));
236 EXPECT_FALSE(
237 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 0))
238 .match(NegOne));
239
240 EXPECT_TRUE(
241 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 1))
242 .match(Zero));
243 EXPECT_FALSE(
244 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 1))
245 .match(One));
246 EXPECT_FALSE(
247 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, 1))
248 .match(NegOne));
249
250 EXPECT_TRUE(
251 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, -1))
252 .match(Zero));
253 EXPECT_TRUE(
254 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, -1))
255 .match(One));
256 EXPECT_FALSE(
257 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULT, APInt(BitWidth, -1))
258 .match(NegOne));
259 }
260
261 TEST_F(PatternMatchTest, SpecificIntULE) {
262 Type *IntTy = IRB.getInt32Ty();
263 unsigned BitWidth = IntTy->getScalarSizeInBits();
264
265 Value *Zero = ConstantInt::get(IntTy, 0);
266 Value *One = ConstantInt::get(IntTy, 1);
267 Value *NegOne = ConstantInt::get(IntTy, -1);
268
269 EXPECT_TRUE(
270 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 0))
271 .match(Zero));
272 EXPECT_FALSE(
273 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 0))
274 .match(One));
275 EXPECT_FALSE(
276 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 0))
277 .match(NegOne));
278
279 EXPECT_TRUE(
280 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 1))
281 .match(Zero));
282 EXPECT_TRUE(
283 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 1))
284 .match(One));
285 EXPECT_FALSE(
286 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, 1))
287 .match(NegOne));
288
289 EXPECT_TRUE(
290 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, -1))
291 .match(Zero));
292 EXPECT_TRUE(
293 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, -1))
294 .match(One));
295 EXPECT_TRUE(
296 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_ULE, APInt(BitWidth, -1))
297 .match(NegOne));
298 }
299
300 TEST_F(PatternMatchTest, SpecificIntSGT) {
301 Type *IntTy = IRB.getInt32Ty();
302 unsigned BitWidth = IntTy->getScalarSizeInBits();
303
304 Value *Zero = ConstantInt::get(IntTy, 0);
305 Value *One = ConstantInt::get(IntTy, 1);
306 Value *NegOne = ConstantInt::get(IntTy, -1);
307
308 EXPECT_FALSE(
309 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 0))
310 .match(Zero));
311 EXPECT_TRUE(
312 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 0))
313 .match(One));
314 EXPECT_FALSE(
315 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 0))
316 .match(NegOne));
317
318 EXPECT_FALSE(
319 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 1))
320 .match(Zero));
321 EXPECT_FALSE(
322 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 1))
323 .match(One));
324 EXPECT_FALSE(
325 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, 1))
326 .match(NegOne));
327
328 EXPECT_TRUE(
329 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, -1))
330 .match(Zero));
331 EXPECT_TRUE(
332 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, -1))
333 .match(One));
334 EXPECT_FALSE(
335 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGT, APInt(BitWidth, -1))
336 .match(NegOne));
337 }
338
339 TEST_F(PatternMatchTest, SpecificIntSGE) {
340 Type *IntTy = IRB.getInt32Ty();
341 unsigned BitWidth = IntTy->getScalarSizeInBits();
342
343 Value *Zero = ConstantInt::get(IntTy, 0);
344 Value *One = ConstantInt::get(IntTy, 1);
345 Value *NegOne = ConstantInt::get(IntTy, -1);
346
347 EXPECT_TRUE(
348 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 0))
349 .match(Zero));
350 EXPECT_TRUE(
351 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 0))
352 .match(One));
353 EXPECT_FALSE(
354 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 0))
355 .match(NegOne));
356
357 EXPECT_FALSE(
358 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 1))
359 .match(Zero));
360 EXPECT_TRUE(
361 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 1))
362 .match(One));
363 EXPECT_FALSE(
364 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, 1))
365 .match(NegOne));
366
367 EXPECT_TRUE(
368 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, -1))
369 .match(Zero));
370 EXPECT_TRUE(
371 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, -1))
372 .match(One));
373 EXPECT_TRUE(
374 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SGE, APInt(BitWidth, -1))
375 .match(NegOne));
376 }
377
378 TEST_F(PatternMatchTest, SpecificIntSLT) {
379 Type *IntTy = IRB.getInt32Ty();
380 unsigned BitWidth = IntTy->getScalarSizeInBits();
381
382 Value *Zero = ConstantInt::get(IntTy, 0);
383 Value *One = ConstantInt::get(IntTy, 1);
384 Value *NegOne = ConstantInt::get(IntTy, -1);
385
386 EXPECT_FALSE(
387 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 0))
388 .match(Zero));
389 EXPECT_FALSE(
390 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 0))
391 .match(One));
392 EXPECT_TRUE(
393 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 0))
394 .match(NegOne));
395
396 EXPECT_TRUE(
397 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 1))
398 .match(Zero));
399 EXPECT_FALSE(
400 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 1))
401 .match(One));
402 EXPECT_TRUE(
403 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, 1))
404 .match(NegOne));
405
406 EXPECT_FALSE(
407 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, -1))
408 .match(Zero));
409 EXPECT_FALSE(
410 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, -1))
411 .match(One));
412 EXPECT_FALSE(
413 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLT, APInt(BitWidth, -1))
414 .match(NegOne));
415 }
416
417 TEST_F(PatternMatchTest, SpecificIntSLE) {
418 Type *IntTy = IRB.getInt32Ty();
419 unsigned BitWidth = IntTy->getScalarSizeInBits();
420
421 Value *Zero = ConstantInt::get(IntTy, 0);
422 Value *One = ConstantInt::get(IntTy, 1);
423 Value *NegOne = ConstantInt::get(IntTy, -1);
424
425 EXPECT_TRUE(
426 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 0))
427 .match(Zero));
428 EXPECT_FALSE(
429 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 0))
430 .match(One));
431 EXPECT_TRUE(
432 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 0))
433 .match(NegOne));
434
435 EXPECT_TRUE(
436 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 1))
437 .match(Zero));
438 EXPECT_TRUE(
439 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 1))
440 .match(One));
441 EXPECT_TRUE(
442 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, 1))
443 .match(NegOne));
444
445 EXPECT_FALSE(
446 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, -1))
447 .match(Zero));
448 EXPECT_FALSE(
449 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, -1))
450 .match(One));
451 EXPECT_TRUE(
452 m_SpecificInt_ICMP(ICmpInst::Predicate::ICMP_SLE, APInt(BitWidth, -1))
453 .match(NegOne));
85454 }
86455
87456 TEST_F(PatternMatchTest, CommutativeDeferredValue) {