Skip to content

Commit 686d1cd

Browse files
committed
[CodeGen] LiveRegMatrix: Use allocator through a unique_ptr
1 parent 30f386c commit 686d1cd

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

llvm/include/llvm/CodeGen/LiveRegMatrix.h

+3-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class LiveRegMatrix {
4848
unsigned UserTag = 0;
4949

5050
// The matrix is represented as a LiveIntervalUnion per register unit.
51-
LiveIntervalUnion::Allocator LIUAlloc;
51+
std::unique_ptr<LiveIntervalUnion::Allocator> LIUAlloc;
5252
LiveIntervalUnion::Array Matrix;
5353

5454
// Cached queries per register unit.
@@ -59,15 +59,11 @@ class LiveRegMatrix {
5959
unsigned RegMaskVirtReg = 0;
6060
BitVector RegMaskUsable;
6161

62-
LiveRegMatrix() = default;
62+
LiveRegMatrix() : LIUAlloc(new LiveIntervalUnion::Allocator()) {};
6363
void releaseMemory();
6464

6565
public:
66-
LiveRegMatrix(LiveRegMatrix &&Other)
67-
: TRI(Other.TRI), LIS(Other.LIS), VRM(Other.VRM), UserTag(Other.UserTag),
68-
Matrix(std::move(Other.Matrix)), Queries(std::move(Other.Queries)),
69-
RegMaskTag(Other.RegMaskTag), RegMaskVirtReg(Other.RegMaskVirtReg),
70-
RegMaskUsable(std::move(Other.RegMaskUsable)) {}
66+
LiveRegMatrix(LiveRegMatrix &&Other) = default;
7167

7268
void init(MachineFunction &MF, LiveIntervals &LIS, VirtRegMap &VRM);
7369

llvm/lib/CodeGen/LiveRegMatrix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void LiveRegMatrix::init(MachineFunction &MF, LiveIntervals &pLIS,
6666
unsigned NumRegUnits = TRI->getNumRegUnits();
6767
if (NumRegUnits != Matrix.size())
6868
Queries.reset(new LiveIntervalUnion::Query[NumRegUnits]);
69-
Matrix.init(LIUAlloc, NumRegUnits);
69+
Matrix.init(*LIUAlloc, NumRegUnits);
7070

7171
// Make sure no stale queries get reused.
7272
invalidateVirtRegs();

0 commit comments

Comments
 (0)