[llvm] [Analysis] Use usub_sat during SCEV expansion in some cases (PR #216975)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 05:17:00 PDT 2026
================
@@ -269,6 +269,13 @@ m_scev_SMax(const Op0_t &Op0, const Op1_t &Op1) {
return m_scev_Binary<SCEVSMaxExpr>(Op0, Op1);
}
+template <typename Op0_t, typename Op1_t>
+inline SCEVBinaryExpr_match<SCEVUMaxExpr, Op0_t, Op1_t, SCEV::FlagAnyWrap, true>
+m_scev_UMax(const Op0_t &Op0, const Op1_t &Op1) {
----------------
fhahn wrote:
That's fair, my main point is that we should be consistent with the existing matcher. Having `m_scev_SMax` match non-commutitiave vs `m_scevUMax` matching commutative is inconsistent/confusing.
So we could change `m_scev_SMax` as well, although the commutative part there and for `m_scevUMax` would be dead code/untested as per SCEVs operand ordering for the current uses. It also requires slightly more work although that's unlikely to really matter in practice
https://github.com/llvm/llvm-project/pull/216975
More information about the llvm-commits
mailing list