[PATCH] D129206: [ADT] Use Empty Base Optimization for Allocators
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 6 10:23:44 PDT 2022
dblaikie added a comment.
Got some testing for this? Perhaps some static_asserts in the unit test class that demonstrates the smaller size? (specifically, I thought the EBO only applied to the first base class or something like that, so the StringMap case where the allocator is the second base I'm not sure would correctly trigger EBO?)
================
Comment at: llvm/include/llvm/ADT/ScopedHashTable.h:178-181
+ AllocatorTy &getAllocator() { return static_cast<AllocTy &>(*this); }
+ const AllocatorTy &getAllocator() const {
+ return static_cast<const AllocTy &>(*this);
+ }
----------------
Are these casts necessary? Looks like the conversion is implicit/would work without the casts?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129206/new/
https://reviews.llvm.org/D129206
More information about the llvm-commits
mailing list