mlir: Avoid SmallVector::set_size in SerializeToHsacoPass::loadLibraries
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 12 Jan 2022 02:11:15 +0000 (18:11 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 13 Jan 2022 18:17:00 +0000 (10:17 -0800)
commitb77d4d54f96a1110f1d83e19f773ac93537ca3f9
treeb3572c6055620e732afd10f0c3231f69041969b2
parent529f098789d334de9cd06e913ad9525719fa0774
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
mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp