summaryrefslogtreecommitdiff
path: root/mlir/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorSean Silva <silvasean@google.com>2020-05-26 16:44:20 -0700
committerSean Silva <silvasean@google.com>2020-05-27 13:39:48 -0700
commit9546d8b108dce03e03e0448cebbca5fa0fe4be21 (patch)
tree4fb27c8f08ee79ed29db5ac9e5ef843ccabd3dd0 /mlir/lib/IR/Attributes.cpp
parent98ef93eabd768e51aa58c7623a9fe220ab471715 (diff)
[mlir][core] Add IndexElementsAttr helpers.
Summary: In a follow-up, I'll update the Shape dialect to use this instead of I64ElementsAttr. Differential Revision: https://reviews.llvm.org/D80601
Diffstat (limited to 'mlir/lib/IR/Attributes.cpp')
-rw-r--r--mlir/lib/IR/Attributes.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp
index 540c3c6258e2..12fd08787fa7 100644
--- a/mlir/lib/IR/Attributes.cpp
+++ b/mlir/lib/IR/Attributes.cpp
@@ -624,6 +624,8 @@ Attribute DenseElementsAttr::AttributeElementIterator::operator*() const {
owner.getContext());
return IntegerAttr::get(eltTy, *IntElementIterator(owner, index));
}
+ if (eltTy.isa<IndexType>())
+ return IntegerAttr::get(eltTy, *IntElementIterator(owner, index));
if (auto floatEltTy = eltTy.dyn_cast<FloatType>()) {
IntElementIterator intIt(owner, index);
FloatElementIterator floatIt(floatEltTy.getFloatSemantics(), intIt);