Skip to content

Conversation

@adam-smnk
Copy link
Contributor

Fixes upfront space allocation after #126716

Fixes upfront space allocation after llvm#126716
@llvmbot
Copy link
Member

llvmbot commented Feb 19, 2025

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-dlti

Author: Adam Siemieniuk (adam-smnk)

Changes

Fixes upfront space allocation after #126716


Full diff: https://github.com/llvm/llvm-project/pull/127786.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/DLTI/DLTI.cpp (+2-1)
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));
 

Copy link
Contributor

@rolfmorel rolfmorel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah. Should have looked more carefully at that myself.

LGTM now though!

@adam-smnk adam-smnk merged commit c6a907a into llvm:main Feb 19, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants