Instead of storing an UncommonIndex on the Symbol, use a flag bit to store
whether the Symbol has an Uncommon. This shrinks Chromium's .bc files (after
D32061) by about 1%.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/include/llvm/Object/IRSymtab.h | ||
---|---|---|
288 ↗ | (On Diff #95263) | Should this be Uncommons.end() instead of nullptr? Otherwise, will UncI ever be nullptr allowing the SymbolRef::operator== to detect the end of the symbol_range? I see where we increment UncI, but not how it could be nullptr at the end of the Uncommons range. |
llvm/lib/Object/IRSymtab.cpp | ||
37 ↗ | (On Diff #95263) | Is the restructuring in this file related to the change to set the new flag? I couldn't figure out how. It looks like a good change, but if unrelated can you commit separately? |
llvm/include/llvm/Object/IRSymtab.h | ||
---|---|---|
288 ↗ | (On Diff #95263) | We only use SymI for iterator comparisons, so it doesn't matter what value UncI has at the end of the range. |
llvm/lib/Object/IRSymtab.cpp | ||
37 ↗ | (On Diff #95263) | I made this change to simplify setting a correct value for UncBegin in the storage::Module, which would be more difficult if we enumerated modules separately from symbols. |
LGTM with one suggestion below.
llvm/include/llvm/Object/IRSymtab.h | ||
---|---|---|
288 ↗ | (On Diff #95263) | Ok, missed that. Still, it seems odd not just to use Uncommons.end() here, instead of the less-meaningful nullptr. Suggest changing if that doesn't hurt anything. |
llvm/lib/Object/IRSymtab.cpp | ||
37 ↗ | (On Diff #95263) | Got it - because Uncommons wouldn't be updated after each call to addModule. |
llvm/include/llvm/Object/IRSymtab.h | ||
---|---|---|
288 ↗ | (On Diff #95263) | I think that would be a little confusing. If I were reading this code and I saw Uncommons.end() here I would draw the conclusion that the pointer value in the end iterator is probably being used somehow, which would lead me to believe that there may be a bug in module_symbols() because it is passing nullptr. Using nullptr in both places makes it clear that the value is unimportant. |
llvm/include/llvm/Object/IRSymtab.h | ||
---|---|---|
288 ↗ | (On Diff #95263) | I guess it isn't straightforward to get the end iterator in the module_symbols case. Fair enough. |