[llvm] [RFC][MC] Cache MCRegAliasIterator (PR #93510)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 01:25:22 PDT 2024
================
@@ -187,6 +187,9 @@ class MCRegisterInfo {
DenseMap<MCRegister, int> L2SEHRegs; // LLVM to SEH regs mapping
DenseMap<MCRegister, int> L2CVRegs; // LLVM to CV regs mapping
+ mutable std::vector<std::vector<MCPhysReg>> RegAliasesCache;
----------------
nikic wrote:
> @nikic SmallVector is 32 bytes, it has one more pointer for some reason.
That doesn't sound right. SmallVector should be 16 bytes large if the element type is 4 bytes... uh, I just saw that MCPhyReg is only 2 bytes, which increases SmallVector size to 24 bytes. And of course there's no way to disable that heuristic. So yeah, SmallVector won't make things smaller here (but it also shouldn't be 32 bytes either...)
> Though it means I can use `SmallVector<MCPhysReg, 4>` and store small alias sets inline, so I think it's worth the size increase.
But this also means that you allocate those 4 inline elements for all of the registers that are not actually queried. It's probably not worthwhile in this context.
https://github.com/llvm/llvm-project/pull/93510
More information about the llvm-commits
mailing list