[llvm] Match the inverse of m_AddOverflow (PR #147215)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jul  7 00:12:28 PDT 2025
    
    
  
================
@@ -2595,6 +2595,70 @@ struct UAddWithOverflow_match {
   }
 };
 
+//===----------------------------------------------------------------------===//
+// Matchers for overflow check patterns: e.g. (a + b) u< a, (a ^ -1) <u b
+// Note that S might be matched to other instructions than AddInst.
+//
+
+template <typename LHS_t, typename RHS_t, typename Sum_t>
+struct UAddWithOverflowInv_match {
----------------
nikic wrote:
Can we handle this by adding an Invert template parameter to UAddWithOverflow which just inverts the Pred at the start and otherwise shares the code?
https://github.com/llvm/llvm-project/pull/147215
    
    
More information about the llvm-commits
mailing list