projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
24ad385
)
[mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat.
author
River Riddle
<riddleriver@gmail.com>
Tue, 5 May 2020 19:39:29 +0000
(12:39 -0700)
committer
River Riddle
<riddleriver@gmail.com>
Tue, 5 May 2020 19:42:37 +0000
(12:42 -0700)
mlir/lib/IR/Attributes.cpp
patch
|
blob
|
history
diff --git
a/mlir/lib/IR/Attributes.cpp
b/mlir/lib/IR/Attributes.cpp
index
a150fcd
..
f47f80c
100644
(file)
--- a/
mlir/lib/IR/Attributes.cpp
+++ b/
mlir/lib/IR/Attributes.cpp
@@
-639,8
+639,10
@@
Attribute DenseElementsAttr::AttributeElementIterator::operator*() const {
FloatElementIterator floatIt(floatEltTy.getFloatSemantics(), intIt);
return FloatAttr::get(eltTy, *floatIt);
}
- if (owner.isa<DenseStringElementsAttr>())
- return StringAttr::get(owner.getRawStringData()[index], eltTy);
+ if (owner.isa<DenseStringElementsAttr>()) {
+ ArrayRef<StringRef> vals = owner.getRawStringData();
+ return StringAttr::get(owner.isSplat() ? vals.front() : vals[index], eltTy);
+ }
llvm_unreachable("unexpected element type");
}