[Mlir-commits] [mlir] [MLIR] Extend the extractvalue fold method (PR #172297)
Matthias Springer
llvmlistbot at llvm.org
Mon Dec 15 06:34:57 PST 2025
================
@@ -1898,6 +1898,23 @@ static Type getInsertExtractValueElementType(Type llvmType,
return llvmType;
}
+/// Extract the element at `index` from `attr` if it is an `ElementsAttr` or
+/// `ArrayAttr`. Returns `nullptr` if `attr` is not one of those types or if the
+/// `index` is out of bounds.
+static Attribute extractElementAt(Attribute attr, size_t index) {
+ if (auto elementsAttr = dyn_cast<ElementsAttr>(attr)) {
----------------
matthias-springer wrote:
Does this also match DenseElementsAttr? (Which you removed below.)
https://github.com/llvm/llvm-project/pull/172297
More information about the Mlir-commits
mailing list