diff options
| author | River Riddle <riverriddle@google.com> | 2019-08-21 10:23:14 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-08-21 10:23:44 -0700 |
| commit | b9dc2e481818315f2f0d87455349f497f6118a4c (patch) | |
| tree | 6e4d9f358632f63e3016b47e8f5ae3381e5d8812 /mlir/lib/Target | |
| parent | 7e1af594d2d3769d160659709a03b3a9bb22a6fa (diff) | |
| download | bcm5719-llvm-b9dc2e481818315f2f0d87455349f497f6118a4c.tar.gz bcm5719-llvm-b9dc2e481818315f2f0d87455349f497f6118a4c.zip | |
Add iterator support to ElementsAttr and SparseElementsAttr.
This will allow iterating the values of a non-opaque ElementsAttr, with all of the types currently supported by DenseElementsAttr. This should help reduce the amount of specialization on DenseElementsAttr.
PiperOrigin-RevId: 264637293
Diffstat (limited to 'mlir/lib/Target')
| -rw-r--r-- | mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index bea22c9753c..e872794d426 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -90,12 +90,12 @@ llvm::Constant *ModuleTranslation::getLLVMConstant(llvm::Type *llvmType, splatAttr.getSplatValue(), loc); return llvm::ConstantVector::getSplat(vectorType->getNumElements(), child); } - if (auto denseAttr = attr.dyn_cast<DenseElementsAttr>()) { + if (auto elementsAttr = attr.dyn_cast<ElementsAttr>()) { auto *vectorType = cast<llvm::VectorType>(llvmType); SmallVector<llvm::Constant *, 8> constants; uint64_t numElements = vectorType->getNumElements(); constants.reserve(numElements); - for (auto n : denseAttr.getAttributeValues()) { + for (auto n : elementsAttr.getValues<Attribute>()) { constants.push_back( getLLVMConstant(vectorType->getElementType(), n, loc)); if (!constants.back()) |

