@@ -9384,19 +9384,6 @@ isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
9384
9384
}
9385
9385
}
9386
9386
9387
- // / Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true.
9388
- // / Return false if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is false.
9389
- // / Otherwise, return std::nullopt if we can't infer anything.
9390
- static std::optional<bool > isImpliedCondMatchingOperands (CmpPredicate LPred,
9391
- CmpPredicate RPred) {
9392
- if (ICmpInst::isImpliedTrueByMatchingCmp (LPred, RPred))
9393
- return true ;
9394
- if (ICmpInst::isImpliedFalseByMatchingCmp (LPred, RPred))
9395
- return false ;
9396
-
9397
- return std::nullopt ;
9398
- }
9399
-
9400
9387
// / Return true if "icmp LPred X, LCR" implies "icmp RPred X, RCR" is true.
9401
9388
// / Return false if "icmp LPred X, LCR" implies "icmp RPred X, RCR" is false.
9402
9389
// / Otherwise, return std::nullopt if we can't infer anything.
@@ -9489,7 +9476,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
9489
9476
9490
9477
// Can we infer anything when the two compares have matching operands?
9491
9478
if (L0 == R0 && L1 == R1)
9492
- return isImpliedCondMatchingOperands (LPred, RPred);
9479
+ return ICmpInst::isImpliedByMatchingCmp (LPred, RPred);
9493
9480
9494
9481
// It only really makes sense in the context of signed comparison for "X - Y
9495
9482
// must be positive if X >= Y and no overflow".
@@ -9499,7 +9486,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
9499
9486
CmpPredicate::getMatching (LPred, ICmpInst::ICMP_SGE)) &&
9500
9487
match (R0, m_NSWSub (m_Specific (L0), m_Specific (L1)))) {
9501
9488
if (match (R1, m_NonPositive ()) &&
9502
- isImpliedCondMatchingOperands (LPred, RPred) == false )
9489
+ ICmpInst::isImpliedByMatchingCmp (LPred, RPred) == false )
9503
9490
return false ;
9504
9491
}
9505
9492
@@ -9509,7 +9496,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
9509
9496
CmpPredicate::getMatching (LPred, ICmpInst::ICMP_SLE)) &&
9510
9497
match (R0, m_NSWSub (m_Specific (L0), m_Specific (L1)))) {
9511
9498
if (match (R1, m_NonNegative ()) &&
9512
- isImpliedCondMatchingOperands (LPred, RPred) == true )
9499
+ ICmpInst::isImpliedByMatchingCmp (LPred, RPred) == true )
9513
9500
return true ;
9514
9501
}
9515
9502
0 commit comments