[Mlir-commits] [mlir] 94f848d - Add Builder::getI64VectorAttr.
Sean Silva
llvmlistbot at llvm.org
Fri Mar 13 15:04:18 PDT 2020
Author: Sean Silva
Date: 2020-03-13T15:03:22-07:00
New Revision: 94f848d7b569981edba7405da87886fa1fae9898
URL: https://github.com/llvm/llvm-project/commit/94f848d7b569981edba7405da87886fa1fae9898
DIFF: https://github.com/llvm/llvm-project/commit/94f848d7b569981edba7405da87886fa1fae9898.diff
LOG: Add Builder::getI64VectorAttr.
This matches Builder::getI32VectorAttr.
Differential Revision: https://reviews.llvm.org/D75883
Added:
Modified:
mlir/include/mlir/IR/Builders.h
mlir/lib/IR/Builders.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h
index ec4bcf75547b..3817b35ea7cf 100644
--- a/mlir/include/mlir/IR/Builders.h
+++ b/mlir/include/mlir/IR/Builders.h
@@ -117,6 +117,7 @@ class Builder {
IntegerAttr getUI32IntegerAttr(uint32_t value);
DenseIntElementsAttr getI32VectorAttr(ArrayRef<int32_t> values);
+ DenseIntElementsAttr getI64VectorAttr(ArrayRef<int64_t> values);
ArrayAttr getAffineMapArrayAttr(ArrayRef<AffineMap> values);
ArrayAttr getI32ArrayAttr(ArrayRef<int32_t> values);
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp
index dab357975d85..82d2efb5255c 100644
--- a/mlir/lib/IR/Builders.cpp
+++ b/mlir/lib/IR/Builders.cpp
@@ -98,11 +98,15 @@ IntegerAttr Builder::getI64IntegerAttr(int64_t value) {
}
DenseIntElementsAttr Builder::getI32VectorAttr(ArrayRef<int32_t> values) {
- return DenseElementsAttr::get(
- VectorType::get(static_cast<int64_t>(values.size()),
- getIntegerType(32)),
- values)
- .cast<DenseIntElementsAttr>();
+ return DenseIntElementsAttr::get(
+ VectorType::get(static_cast<int64_t>(values.size()), getIntegerType(32)),
+ values);
+}
+
+DenseIntElementsAttr Builder::getI64VectorAttr(ArrayRef<int64_t> values) {
+ return DenseIntElementsAttr::get(
+ VectorType::get(static_cast<int64_t>(values.size()), getIntegerType(64)),
+ values);
}
IntegerAttr Builder::getI32IntegerAttr(int32_t value) {
More information about the Mlir-commits
mailing list