[Mlir-commits] [mlir] [mlir][dlti] Fix query keys preallocation (PR #127786)

Adam Siemieniuk llvmlistbot at llvm.org
Wed Feb 19 03:33:18 PST 2025


https://github.com/adam-smnk created https://github.com/llvm/llvm-project/pull/127786

Fixes upfront space allocation after #126716

>From ffb9743a848192b89f6552fae8e7f982b8f8dd3e Mon Sep 17 00:00:00 2001
From: Adam Siemieniuk <adam.siemieniuk at intel.com>
Date: Wed, 19 Feb 2025 12:29:11 +0100
Subject: [PATCH] [mlir][dlti] Fix query keys preallocation

Fixes upfront space allocation after #126716
---
 mlir/lib/Dialect/DLTI/DLTI.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/DLTI/DLTI.cpp b/mlir/lib/Dialect/DLTI/DLTI.cpp
index b057554c40d8c..70e05cb4cb383 100644
--- a/mlir/lib/Dialect/DLTI/DLTI.cpp
+++ b/mlir/lib/Dialect/DLTI/DLTI.cpp
@@ -571,7 +571,8 @@ FailureOr<Attribute> dlti::query(Operation *op, ArrayRef<StringRef> keys,
     return failure();
 
   MLIRContext *ctx = op->getContext();
-  SmallVector<DataLayoutEntryKey> entryKeys(keys.size());
+  SmallVector<DataLayoutEntryKey> entryKeys;
+  entryKeys.reserve(keys.size());
   for (StringRef key : keys)
     entryKeys.push_back(StringAttr::get(ctx, key));
 



More information about the Mlir-commits mailing list