[Mlir-commits] [mlir] [mlir][dlti] Query by strings (PR #126716)

Rolf Morel llvmlistbot at llvm.org
Tue Feb 11 04:15:02 PST 2025


================
@@ -562,6 +565,19 @@ dlti::query(Operation *op, ArrayRef<DataLayoutEntryKey> keys, bool emitError) {
   return currentAttr;
 }
 
+FailureOr<Attribute> dlti::query(Operation *op, ArrayRef<StringRef> keys,
+                                 bool emitError) {
+  if (!op)
+    return failure();
+
+  MLIRContext *ctx = op->getContext();
+  SmallVector<DataLayoutEntryKey> entryKeys;
----------------
rolfmorel wrote:

Nit: `entryKeys` will become the size of `keys`, so we can allocate the space for it upfront (even though the length of `keys` is likely so small that it will fit in the stack-allocated space any way).

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


More information about the Mlir-commits mailing list