[Mlir-commits] [mlir] [mlir] Specify namespace in td file pred (PR #152258)

Shay Kleiman llvmlistbot at llvm.org
Tue Aug 5 23:59:44 PDT 2025


https://github.com/shay-kl created https://github.com/llvm/llvm-project/pull/152258

Lack of llvm namespace here caused an "'ArrayRef' was not declared in this scope" error when using the ShapedTypeWithNthDimOfSize pred in a td file. Explicitly specifying it fixes it.

>From 9a18e9549ecdd8a289f9b3e763fbf4caa9f1ffbe Mon Sep 17 00:00:00 2001
From: Shay Kleiman <shay.kleiman at mobileye.com>
Date: Wed, 6 Aug 2025 09:43:31 +0300
Subject: [PATCH] [mlir] Specify namespace in td file pred

Lack of llvm namespace here caused an "'ArrayRef' was not declared in
this scope" error when including the ShapedTypeWithNthDimOfSize  pred in
a td file. Explicitly specifying it fixes it.

Change-Id: Id00361d2aa5d22c875c776503224e5d1cce2503f
---
 mlir/include/mlir/IR/CommonTypeConstraints.td | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/IR/CommonTypeConstraints.td b/mlir/include/mlir/IR/CommonTypeConstraints.td
index 45ec1846580f2..13b04aad6c6aa 100644
--- a/mlir/include/mlir/IR/CommonTypeConstraints.td
+++ b/mlir/include/mlir/IR/CommonTypeConstraints.td
@@ -576,7 +576,7 @@ class NormalizeIndex<int value> {
 class IsNthDimSizeIsOneOfPred<int n, list<int> allowedSizes>
   : And<[
       CPred<"::llvm::cast<::mlir::ShapedType>($_self).getRank() >= " # NormalizeIndex<n>.ret>,
-      CPred<"::llvm::is_contained(ArrayRef<int64_t>({" # !interleave(allowedSizes, ", ") # "}), "
+      CPred<"::llvm::is_contained(llvm::ArrayRef<int64_t>({" # !interleave(allowedSizes, ", ") # "}), "
         # "::llvm::cast<::mlir::ShapedType>($_self).getDimSize("
         #   !if(!lt(n, 0),
               "::llvm::cast<::mlir::ShapedType>($_self).getRank() + " # n,
@@ -585,7 +585,7 @@ class IsNthDimSizeIsOneOfPred<int n, list<int> allowedSizes>
 
 // Whether the shape of a vector matches the given `shape` list.
 class IsVectorOfShape<list<int> shape>
-  : CPred<"::llvm::cast<::mlir::VectorType>($_self).getShape() == ArrayRef<int64_t>({" # !interleave(shape, ", ") # "})">;
+  : CPred<"::llvm::cast<::mlir::VectorType>($_self).getShape() == llvm::ArrayRef<int64_t>({" # !interleave(shape, ", ") # "})">;
 
 // Any vector where the number of elements is from the given
 // `allowedLengths` list



More information about the Mlir-commits mailing list