Skip to content

Commit 0063bb3

Browse files
committed
change to member object
1 parent c0ee13e commit 0063bb3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ class RegisterCoalescer : private LiveRangeEdit::Delegate {
376376
LiveRange &RegRange, JoinVals &Vals2);
377377

378378
public:
379+
// For legacy pass only.
380+
RegisterCoalescer() {}
381+
RegisterCoalescer &operator=(RegisterCoalescer &&Other) = default;
382+
379383
RegisterCoalescer(LiveIntervals *LIS, SlotIndexes *SI,
380384
const MachineLoopInfo *Loops)
381385
: LIS(LIS), SI(SI), Loops(Loops) {}
@@ -385,7 +389,7 @@ class RegisterCoalescer : private LiveRangeEdit::Delegate {
385389
};
386390

387391
class RegisterCoalescerLegacy : public MachineFunctionPass {
388-
std::unique_ptr<RegisterCoalescer> Impl;
392+
RegisterCoalescer Impl;
389393

390394
public:
391395
static char ID; ///< Class identification, replacement for typeinfo
@@ -401,7 +405,7 @@ class RegisterCoalescerLegacy : public MachineFunctionPass {
401405
MachineFunctionProperties::Property::IsSSA);
402406
}
403407

404-
void releaseMemory() override { Impl->releaseMemory(); }
408+
void releaseMemory() override { Impl.releaseMemory(); }
405409

406410
/// This is the pass entry point.
407411
bool runOnMachineFunction(MachineFunction &) override;
@@ -4272,8 +4276,8 @@ bool RegisterCoalescerLegacy::runOnMachineFunction(MachineFunction &MF) {
42724276
auto *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
42734277
auto *SIWrapper = getAnalysisIfAvailable<SlotIndexesWrapperPass>();
42744278
SlotIndexes *SI = SIWrapper ? &SIWrapper->getSI() : nullptr;
4275-
Impl.reset(new RegisterCoalescer(LIS, SI, Loops));
4276-
return Impl->run(MF);
4279+
Impl = RegisterCoalescer(LIS, SI, Loops);
4280+
return Impl.run(MF);
42774281
}
42784282

42794283
bool RegisterCoalescer::run(MachineFunction &fn) {

0 commit comments

Comments
 (0)