[llvm] [CodeGen] Allocate RegAllocHints map lazily (PR #102186)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 23:09:02 PDT 2024


================
@@ -801,6 +801,7 @@ class MachineRegisterInfo {
   /// of an earlier hint it will be overwritten.
   void setRegAllocationHint(Register VReg, unsigned Type, Register PrefReg) {
     assert(VReg.isVirtual());
+    RegAllocHints.grow(Register::index2VirtReg(getNumVirtRegs()));
----------------
topperc wrote:

Should this be `getNumVirtRegs() - 1`? `grow` expects an index. getNumVRegs() is one past the largest index. Or maybe we could use `resize`?

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


More information about the llvm-commits mailing list