[Mlir-commits] [mlir] [mlir] Add `isStatic`* size check for `ShapedType`s. NFCI. (PR #147085)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Jul 7 01:59:29 PDT 2025


================
@@ -221,7 +221,17 @@ def ShapedTypeInterface : TypeInterface<"ShapedType"> {
 
     /// Whether the given shape has any size that indicates a dynamic dimension.
     static bool isDynamicShape(ArrayRef<int64_t> dSizes) {
-      return any_of(dSizes, [](int64_t dSize) { return isDynamic(dSize); });
+      return llvm::any_of(dSizes, isDynamic);
+    }
+
+    /// Whether the given dimension size indicates a statically-sized dimension.
+    static constexpr bool isStatic(int64_t dValue) {
+      return !isDynamic(dValue);
----------------
banach-space wrote:

Given that `isDynamic`/`isStatic` are frequently used, wouldn't it be better to avoid this indirection and do `return dValue != kDynamic;` instead?

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


More information about the Mlir-commits mailing list