[llvm] [RFC][MC] Cache MCRegAliasIterator (PR #93510)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 23:41:15 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;
----------------
Pierre-vh wrote:

note: I wanted to use a vector of `unique_ptr` but it makes it too awkward to use. I can't even use `reserve` in that case, so I didn't do that indirection in the end.

The vector is resized exactly once upon init, and each vector is 3 pointers, so for AMDGPU we have 9000*24 bytes so about 216KB for this map, which is worth it IMO.

https://github.com/llvm/llvm-project/pull/93510


More information about the llvm-commits mailing list