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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 13 10:34:23 PDT 2025


================
@@ -149,12 +149,22 @@ struct is_zero_int {
   bool isValue(const APInt &C) const { return C.isZero(); }
 };
 
+struct is_one {
+  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.
+/// This is different from PatternMatch::m_Zero(), which also matches null
----------------
fhahn wrote:

There's the corresponding PatternMatch::m_ZeroInt, so you can just strip the comment I think.

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


More information about the llvm-commits mailing list