[llvm] [LV] Introduce m_One and improve (0|1)-match (NFC) (PR #157419)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 01:06:10 PDT 2025


================
@@ -149,11 +149,17 @@ struct is_zero_int {
   bool isValue(const APInt &C) const { return C.isZero(); }
 };
 
+struct is_one_int {
+  bool isValue(const APInt &C) const { return C.isOne(); }
+};
+
 /// Match an integer 0 or a vector with all elements equal to 0.
 /// For vectors, this includes constants with undefined elements.
-inline int_pred_ty<is_zero_int> m_ZeroInt() {
-  return int_pred_ty<is_zero_int>();
-}
+inline int_pred_ty<is_zero_int> m_Zero() { return int_pred_ty<is_zero_int>(); }
----------------
lukel97 wrote:

I don't think we should rename m_ZeroInt since m_Zero means something different in LLVM IR. m_Zero also allows null constants e.g. 0.0 floats. 

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


More information about the llvm-commits mailing list