[PATCH] D65304: [MC] Don't recreate a label if it's already used
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 12:02:33 PDT 2019
nickdesaulniers added inline comments.
================
Comment at: lib/MC/MCContext.cpp:64
Symbols(Allocator), UsedNames(Allocator),
+ InlineAsmUsedLabelNames(Allocator),
CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0),
----------------
I think we may want to be invoking the `StringMap` constructor that additionally takes an `InitialSize`, which we'd set to `0U`, as it's highly unlikely that the `%l` modifier is used at all for any given piece of code.
IIUC, `StringMap`'s constructor that simply accepts an allocator will allocate room for 1 instance. See the definition of `StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize)`.
I think that micro optimization would save many small allocations for the general case.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65304/new/
https://reviews.llvm.org/D65304
More information about the llvm-commits
mailing list