[PATCH] D62091: [CommandLine] Reduce size of Option class by moving more members into bit field

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 18 11:16:04 PDT 2019


beanz added inline comments.


================
Comment at: llvm/include/llvm/Support/CommandLine.h:288
       Categories;                    // The Categories this option belongs to
   SmallPtrSet<SubCommand *, 4> Subs; // The subcommands this option belongs to.
 
----------------
beanz wrote:
> Side note: I wonder how many members actually get put into this.  The common-case for most options is surely 0.
>From eyeballing (not an exhaustive search), I don't see anywhere that more than one Sub command is set. You might be able to save more space by shrinking the inline size here. If I read the code right, SmallPtrSet is 32 bytes + (sizeof (T) * N). In this case that should be 64 bytes. Changing the size to 2, would save another 16 bytes per option.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62091/new/

https://reviews.llvm.org/D62091





More information about the llvm-commits mailing list