Skip to content

Commit d23fc3d

Browse files
committed
change to member object
1 parent 1d7d146 commit d23fc3d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 9 additions & 5 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) {}
@@ -386,7 +390,7 @@ class RegisterCoalescer : private LiveRangeEdit::Delegate {
386390
};
387391

388392
class RegisterCoalescerLegacy : public MachineFunctionPass {
389-
std::unique_ptr<RegisterCoalescer> Impl;
393+
RegisterCoalescer Impl;
390394

391395
public:
392396
static char ID; ///< Class identification, replacement for typeinfo
@@ -402,14 +406,14 @@ class RegisterCoalescerLegacy : public MachineFunctionPass {
402406
MachineFunctionProperties::Property::IsSSA);
403407
}
404408

405-
void releaseMemory() override { Impl->releaseMemory(); }
409+
void releaseMemory() override { Impl.releaseMemory(); }
406410

407411
/// This is the pass entry point.
408412
bool runOnMachineFunction(MachineFunction &) override;
409413

410414
/// Implement the dump method.
411415
void print(raw_ostream &O, const Module * = nullptr) const override {
412-
Impl->print(O, nullptr);
416+
Impl.print(O, nullptr);
413417
}
414418
};
415419

@@ -4278,8 +4282,8 @@ bool RegisterCoalescerLegacy::runOnMachineFunction(MachineFunction &MF) {
42784282
auto *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
42794283
auto *SIWrapper = getAnalysisIfAvailable<SlotIndexesWrapperPass>();
42804284
SlotIndexes *SI = SIWrapper ? &SIWrapper->getSI() : nullptr;
4281-
Impl.reset(new RegisterCoalescer(LIS, SI, Loops));
4282-
return Impl->run(MF);
4285+
Impl = RegisterCoalescer(LIS, SI, Loops);
4286+
return Impl.run(MF);
42834287
}
42844288

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

0 commit comments

Comments
 (0)