Index: llvm/lib/Analysis/ValueTracking.cpp =================================================================== --- llvm/lib/Analysis/ValueTracking.cpp +++ llvm/lib/Analysis/ValueTracking.cpp @@ -7938,6 +7938,10 @@ // LHS u<= LHS +_{nuw} C for any C if (match(RHS, m_NUWAdd(m_Specific(LHS), m_APInt(C)))) return true; + + // (RHS >> X) u<= RHS for any X + if (match(LHS, m_LShr(m_Specific(RHS), m_Value()))) + return true; // Match A to (X +_{nuw} CA) and B to (X +_{nuw} CB) auto MatchNUWAddsToSameValue = [&](const Value *A, const Value *B, @@ -7993,6 +7997,13 @@ isTruePredicate(CmpInst::ICMP_ULE, ARHS, BRHS, DL, Depth)) return true; return std::nullopt; + + case CmpInst::ICMP_UGT: + case CmpInst::ICMP_UGE: + if (isTruePredicate(CmpInst::ICMP_ULE, ALHS, BLHS, DL, Depth) && + isTruePredicate(CmpInst::ICMP_ULE, BRHS, ARHS, DL, Depth)) + return true; + return std::nullopt; } }