Skip to content

Commit 4fb8fd4

Browse files
committed
Use yet another allocator for LiveRanges
Not sure it's worth it for these, there should never be all that many. We could pre-allocate the maximum size up front.
1 parent 81d263d commit 4fb8fd4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

llvm/include/llvm/CodeGen/LiveIntervals.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ class LiveIntervals {
6565
MachineDominatorTree *DomTree = nullptr;
6666
std::unique_ptr<LiveIntervalCalc> LICalc;
6767

68-
// Allocator for RegUnitRanges and SubRanges.
68+
// Allocator for SubRanges.
6969
BumpPtrAllocator Allocator;
7070

7171
// Allocator for VirtRegIntervals
7272
SpecificBumpPtrAllocator<LiveInterval> LIAllocator;
7373

74+
// Allocator for RegUnitRanges
75+
SpecificBumpPtrAllocator<LiveRange> LRAllocator;
76+
7477
/// Special pool allocator for VNInfo's (LiveInterval val#).
7578
VNInfo::Allocator VNInfoAllocator;
7679

@@ -423,8 +426,8 @@ class LiveIntervals {
423426
if (!LR) {
424427
// Compute missing ranges on demand.
425428
// Use segment set to speed-up initial computation of the live range.
426-
RegUnitRanges[Unit] = LR = new (Allocator.Allocate<LiveRange>())
427-
LiveRange(UseSegmentSetForPhysRegs);
429+
RegUnitRanges[Unit] = LR =
430+
new (LRAllocator.Allocate()) LiveRange(UseSegmentSetForPhysRegs);
428431
computeRegUnitRange(*LR, Unit);
429432
}
430433
return *LR;

llvm/lib/CodeGen/LiveIntervals.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ void LiveIntervals::clear() {
146146
RegMaskBits.clear();
147147
RegMaskBlocks.clear();
148148

149-
for (LiveRange *LR : RegUnitRanges)
150-
Allocator.Deallocate(LR);
149+
LRAllocator.DestroyAll();
151150
RegUnitRanges.clear();
152151

153152
// Free the live intervals themselves.

0 commit comments

Comments
 (0)