[PATCH] D94800: ADT: Skip SmallVector::isReferenceToStorage when TakesParamByValue, NFC

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 09:25:27 PST 2021


dexonsmith created this revision.
dexonsmith added reviewers: njames93, dblaikie.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Herald added a project: LLVM.

Rename `SmallVectorTemplateCommon::reserveForAndGetAddress()` to
`reserveForParamAndGetAddress()`, clarifying that it should only be called
for "parameter values". Use that semantic information to skip calling
`SmallVector::isReferenceToStorage()` when `TakesParamByValue` (which is
`constexpr`).

This has no functional change, but likely speeds up operations like
`SmallVector::push_back()` for small POD-like types. Even if the
optimizer was smart enough to eliminate the call, this speeds up
compile-time since the call is now trivially dead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94800

Files:
  llvm/include/llvm/ADT/SmallVector.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94800.316998.patch
Type: text/x-patch
Size: 4873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/cd5ed0a3/attachment.bin>


More information about the llvm-commits mailing list