@@ -9384,19 +9384,6 @@ isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
93849384 }
93859385}
93869386
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-
94009387// / Return true if "icmp LPred X, LCR" implies "icmp RPred X, RCR" is true.
94019388// / Return false if "icmp LPred X, LCR" implies "icmp RPred X, RCR" is false.
94029389// / Otherwise, return std::nullopt if we can't infer anything.
@@ -9489,7 +9476,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
94899476
94909477 // Can we infer anything when the two compares have matching operands?
94919478 if (L0 == R0 && L1 == R1)
9492- return isImpliedCondMatchingOperands (LPred, RPred);
9479+ return ICmpInst::isImpliedByMatchingCmp (LPred, RPred);
94939480
94949481 // It only really makes sense in the context of signed comparison for "X - Y
94959482 // must be positive if X >= Y and no overflow".
@@ -9499,7 +9486,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
94999486 CmpPredicate::getMatching (LPred, ICmpInst::ICMP_SGE)) &&
95009487 match (R0, m_NSWSub (m_Specific (L0), m_Specific (L1)))) {
95019488 if (match (R1, m_NonPositive ()) &&
9502- isImpliedCondMatchingOperands (LPred, RPred) == false )
9489+ ICmpInst::isImpliedByMatchingCmp (LPred, RPred) == false )
95039490 return false ;
95049491 }
95059492
@@ -9509,7 +9496,7 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0,
95099496 CmpPredicate::getMatching (LPred, ICmpInst::ICMP_SLE)) &&
95109497 match (R0, m_NSWSub (m_Specific (L0), m_Specific (L1)))) {
95119498 if (match (R1, m_NonNegative ()) &&
9512- isImpliedCondMatchingOperands (LPred, RPred) == true )
9499+ ICmpInst::isImpliedByMatchingCmp (LPred, RPred) == true )
95139500 return true ;
95149501 }
95159502
0 commit comments