[Mlir-commits] [mlir] b77d4d5 - mlir: Avoid SmallVector::set_size in SerializeToHsacoPass::loadLibraries
Duncan P. N. Exon Smith
llvmlistbot at llvm.org
Thu Jan 13 10:17:40 PST 2022
Author: Duncan P. N. Exon Smith
Date: 2022-01-13T10:17:00-08:00
New Revision: b77d4d54f96a1110f1d83e19f773ac93537ca3f9
URL: https://github.com/llvm/llvm-project/commit/b77d4d54f96a1110f1d83e19f773ac93537ca3f9
DIFF: https://github.com/llvm/llvm-project/commit/b77d4d54f96a1110f1d83e19f773ac93537ca3f9.diff
LOG: mlir: Avoid SmallVector::set_size in SerializeToHsacoPass::loadLibraries
Spotted this in a final grep of projects I don't usually build before
pushing https://reviews.llvm.org/D115380, which makes
`SmallVector::set_size()` private.
Update to `truncate()`, a new-ish variant of `resize()` that asserts the
new size is not bigger and that avoids pulling in the allocation and
initialization code for growing. Doesn't really look like the perf
impact of that would matter here, but since `dirLength` is known to be a
smaller size then we might as well.
Differential Revision: https://reviews.llvm.org/D117073
Added:
Modified:
mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp b/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
index 8ffa83f893fb6..75d14d2bb93ea 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
@@ -160,7 +160,7 @@ SerializeToHsacoPass::loadLibraries(SmallVectorImpl<char> &path,
llvm::StringRef pathRef(path.data(), path.size());
std::unique_ptr<llvm::Module> library =
llvm::getLazyIRFileModule(pathRef, error, context);
- path.set_size(dirLength);
+ path.truncate(dirLength);
if (!library) {
getOperation().emitError() << "Failed to load library " << file
<< " from " << path << error.getMessage();
More information about the Mlir-commits
mailing list