[llvm] [Analysis] Use usub_sat during SCEV expansion in some cases (PR #216975)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 03:56:46 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) {
----------------
paulwalker-arm wrote:

I'm always puzzled why we introduce second versions of operations where commutativity does not matter. Is it not better to have a single version that everybody calls and then only have special _c_ variants for cases where commutativity is important because it requires special handling?

https://github.com/llvm/llvm-project/pull/216975


More information about the llvm-commits mailing list