[Mlir-commits] [mlir] [mlir][vector] Add convenience types for scalable vectors (PR #87986)

Jakub Kuderski llvmlistbot at llvm.org
Mon Apr 8 12:45:50 PDT 2024


================
@@ -0,0 +1,27 @@
+//===- VectorTypes.cpp - MLIR Vector Types --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/IR/VectorTypes.h"
+#include "mlir/IR/BuiltinTypes.h"
+
+using namespace mlir;
+using namespace mlir::vector;
+
+bool ScalableVectorType::classof(Type type) {
+  auto vecTy = llvm::dyn_cast<VectorType>(type);
+  if (!vecTy)
+    return false;
+  return vecTy.isScalable();
+}
+
+bool FixedWidthVectorType::classof(Type type) {
+  auto vecTy = llvm::dyn_cast<VectorType>(type);
----------------
kuhar wrote:

```suggestion
  auto vecTy = dyn_cast<VectorType>(type);
```

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


More information about the Mlir-commits mailing list