[Mlir-commits] [mlir] [MLIR][DLTI] Enable types as keys in DLTI-query utils (PR #105995)

Mehdi Amini llvmlistbot at llvm.org
Mon Aug 26 14:38:56 PDT 2024


================
@@ -438,6 +446,15 @@ FailureOr<Attribute> dlti::query(Operation *op, ArrayRef<StringAttr> keys,
     return failure();
   }
 
+  auto keyToStr = [](DataLayoutEntryKey key) -> std::string {
+    std::string buf;
+    llvm::TypeSwitch<DataLayoutEntryKey>(key)
+        .Case<StringAttr, Type>( // The only two kinds of key we know of.
+            [&](auto key) { llvm::raw_string_ostream(buf) << key; })
+        .Default([](auto) { llvm_unreachable("unexpected entry key kind"); });
+    return buf;
+  };
----------------
joker-eph wrote:

That seems expensive to me for the purpose of a query!

Why can't we use a `void*`?

https://github.com/llvm/llvm-project/pull/105995


More information about the Mlir-commits mailing list