[Mlir-commits] [mlir] [MLIR] Let matchers work on int ranges (PR #102494)

Jakub Kuderski llvmlistbot at llvm.org
Fri Aug 9 06:59:13 PDT 2024


================
@@ -385,6 +446,13 @@ inline detail::constant_int_predicate_matcher m_NonZero() {
   return {[](const APInt &value) { return 0 != value; }};
 }
 
+/// Matches a constant scalar / vector splat / tensor splat integer or a
+/// unsigned integer range that does not contain zero. Note that this matcher
+/// interprets the target value as an unsigned integer.
+inline detail::constant_int_range_predicate_matcher m_NonZeroU() {
+  return {[](const ConstantIntRanges &range) { return range.umin().ugt(0); }};
----------------
kuhar wrote:

What kind of overhead should we expect here vs. a simple APInt comparison?

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


More information about the Mlir-commits mailing list