[Mlir-commits] [mlir] [MLIR][DLTI] Enable types as keys in DLTI-query utils (PR #105995)
Rolf Morel
llvmlistbot at llvm.org
Sun Aug 25 16:59:07 PDT 2024
================
@@ -438,6 +438,17 @@ FailureOr<Attribute> dlti::query(Operation *op, ArrayRef<StringAttr> keys,
return failure();
}
+ auto keyToStr = [](DataLayoutEntryKey key) -> std::string {
+ if (auto strKey = llvm::dyn_cast<StringAttr>(key))
+ return "\"" + std::string(strKey.getValue()) + "\"";
----------------
rolfmorel wrote:
Have adjusted this lambda so that it just calls print on the underlying attribute/type. In case of StringAttr, this automatically adds the quotes.
As both `Attribute`s and `Type`s need to implement `print(..)`, I feel it is safe to assume that new kind of keys will always be convertable to strings. As such more attributes as allowed keys should not be a problem.
https://github.com/llvm/llvm-project/pull/105995
More information about the Mlir-commits
mailing list