[llvm] [RFC][MC] Cache MCRegAliasIterator (PR #93510)
    Pierre van Houtryve via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue May 28 03:50:51 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 DenseMap<MCPhysReg, std::vector<MCPhysReg>> RegAliasesCache;
----------------
Pierre-vh wrote:
This could also just be a `std::vector<std::unique_ptr<std::vector<MCPhysReg>>>` where register IDs are the indexes into the vector.
It'd use more space upfront (for AMDGPU, about 9000*8 bytes) but makes accesses a lot faster, and would be more memory efficient if we end up caching tons of aliases.
https://github.com/llvm/llvm-project/pull/93510
    
    
More information about the llvm-commits
mailing list