3030#include " llvm/CodeGen/SlotIndexes.h"
3131#include " llvm/CodeGen/TargetRegisterInfo.h"
3232#include " llvm/MC/LaneBitmask.h"
33+ #include " llvm/Support/Allocator.h"
3334#include " llvm/Support/CommandLine.h"
3435#include " llvm/Support/Compiler.h"
3536#include " llvm/Support/ErrorHandling.h"
@@ -64,6 +65,8 @@ class LiveIntervals {
6465 MachineDominatorTree *DomTree = nullptr ;
6566 std::unique_ptr<LiveIntervalCalc> LICalc;
6667
68+ BumpPtrAllocator Allocator;
69+
6770 // / Special pool allocator for VNInfo's (LiveInterval val#).
6871 VNInfo::Allocator VNInfoAllocator;
6972
@@ -170,7 +173,7 @@ class LiveIntervals {
170173 // / Interval removal.
171174 void removeInterval (Register Reg) {
172175 auto &Interval = VirtRegIntervals[Reg];
173- delete Interval;
176+ Allocator. Deallocate ( Interval) ;
174177 Interval = nullptr ;
175178 }
176179
@@ -416,7 +419,8 @@ class LiveIntervals {
416419 if (!LR) {
417420 // Compute missing ranges on demand.
418421 // Use segment set to speed-up initial computation of the live range.
419- RegUnitRanges[Unit] = LR = new LiveRange (UseSegmentSetForPhysRegs);
422+ RegUnitRanges[Unit] = LR = new (Allocator.Allocate <LiveRange>())
423+ LiveRange (UseSegmentSetForPhysRegs);
420424 computeRegUnitRange (*LR, Unit);
421425 }
422426 return *LR;
@@ -433,7 +437,7 @@ class LiveIntervals {
433437 // / Remove computed live range for register unit \p Unit. Subsequent uses
434438 // / should rely on on-demand recomputation.
435439 void removeRegUnit (unsigned Unit) {
436- delete RegUnitRanges[Unit];
440+ Allocator. Deallocate ( RegUnitRanges[Unit]) ;
437441 RegUnitRanges[Unit] = nullptr ;
438442 }
439443
@@ -481,7 +485,7 @@ class LiveIntervals {
481485 bool computeDeadValues (LiveInterval &LI,
482486 SmallVectorImpl<MachineInstr *> *dead);
483487
484- static LiveInterval *createInterval (Register Reg);
488+ LiveInterval *createInterval (Register Reg);
485489
486490 void printInstrs (raw_ostream &O) const ;
487491 void dumpInstrs () const ;
0 commit comments