diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2025-02-26 23:53:44 +0700 |
|---|---|---|
| committer | Matt Arsenault <arsenm2@gmail.com> | 2025-02-26 23:56:37 +0700 |
| commit | 4fb8fd4cbc5975baaa3139b6db6c1c5d0cc5b585 (patch) | |
| tree | 04f8ac5cc10e4f4302147f63a8ee8c74aa3df4b8 | |
| parent | 81d263d55831cc4c2363a5b2cd8c5272f01c302b (diff) | |
Use yet another allocator for LiveRangesusers/arsenm/live-intervals-use-bumpptrallocator
Not sure it's worth it for these, there should never be all that
many. We could pre-allocate the maximum size up front.
| -rw-r--r-- | llvm/include/llvm/CodeGen/LiveIntervals.h | 9 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervals.cpp | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveIntervals.h b/llvm/include/llvm/CodeGen/LiveIntervals.h index 7cee939d352a..4a4d53ee7c25 100644 --- a/llvm/include/llvm/CodeGen/LiveIntervals.h +++ b/llvm/include/llvm/CodeGen/LiveIntervals.h @@ -65,12 +65,15 @@ class LiveIntervals { MachineDominatorTree *DomTree = nullptr; std::unique_ptr<LiveIntervalCalc> LICalc; - // Allocator for RegUnitRanges and SubRanges. + // Allocator for SubRanges. BumpPtrAllocator Allocator; // Allocator for VirtRegIntervals SpecificBumpPtrAllocator<LiveInterval> LIAllocator; + // Allocator for RegUnitRanges + SpecificBumpPtrAllocator<LiveRange> LRAllocator; + /// Special pool allocator for VNInfo's (LiveInterval val#). VNInfo::Allocator VNInfoAllocator; @@ -423,8 +426,8 @@ public: if (!LR) { // Compute missing ranges on demand. // Use segment set to speed-up initial computation of the live range. - RegUnitRanges[Unit] = LR = new (Allocator.Allocate<LiveRange>()) - LiveRange(UseSegmentSetForPhysRegs); + RegUnitRanges[Unit] = LR = + new (LRAllocator.Allocate()) LiveRange(UseSegmentSetForPhysRegs); computeRegUnitRange(*LR, Unit); } return *LR; diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp index fd5cc3835831..2b46e4e6393d 100644 --- a/llvm/lib/CodeGen/LiveIntervals.cpp +++ b/llvm/lib/CodeGen/LiveIntervals.cpp @@ -146,8 +146,7 @@ void LiveIntervals::clear() { RegMaskBits.clear(); RegMaskBlocks.clear(); - for (LiveRange *LR : RegUnitRanges) - Allocator.Deallocate(LR); + LRAllocator.DestroyAll(); RegUnitRanges.clear(); // Free the live intervals themselves. |
