Skip to content

Commit 396f413

Browse files
committed
change to member object
1 parent 39b2841 commit 396f413

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
@@ -377,6 +377,10 @@ class RegisterCoalescer : private LiveRangeEdit::Delegate {
377377
LiveRange &RegRange, JoinVals &Vals2);
378378

379379
public:
380+
// For legacy pass only.
381+
RegisterCoalescer() {}
382+
RegisterCoalescer &operator=(RegisterCoalescer &&Other) = default;
383+
380384
RegisterCoalescer(LiveIntervals *LIS, SlotIndexes *SI,
381385
const MachineLoopInfo *Loops)
382386
: LIS(LIS), SI(SI), Loops(Loops) {}
@@ -387,7 +391,7 @@ class RegisterCoalescer : private LiveRangeEdit::Delegate {
387391
};
388392

389393
class RegisterCoalescerLegacy : public MachineFunctionPass {
390-
std::unique_ptr<RegisterCoalescer> Impl;
394+
RegisterCoalescer Impl;
391395

392396
public:
393397
static char ID; ///< Class identification, replacement for typeinfo
@@ -403,14 +407,14 @@ class RegisterCoalescerLegacy : public MachineFunctionPass {
403407
MachineFunctionProperties::Property::IsSSA);
404408
}
405409

406-
void releaseMemory() override { Impl->releaseMemory(); }
410+
void releaseMemory() override { Impl.releaseMemory(); }
407411

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

411415
/// Implement the dump method.
412416
void print(raw_ostream &O, const Module * = nullptr) const override {
413-
Impl->print(O, nullptr);
417+
Impl.print(O, nullptr);
414418
}
415419
};
416420

@@ -4281,8 +4285,8 @@ bool RegisterCoalescerLegacy::runOnMachineFunction(MachineFunction &MF) {
42814285
auto *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI();
42824286
auto *SIWrapper = getAnalysisIfAvailable<SlotIndexesWrapperPass>();
42834287
SlotIndexes *SI = SIWrapper ? &SIWrapper->getSI() : nullptr;
4284-
Impl.reset(new RegisterCoalescer(LIS, SI, Loops));
4285-
return Impl->run(MF);
4288+
Impl = RegisterCoalescer(LIS, SI, Loops);
4289+
return Impl.run(MF);
42864290
}
42874291

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

0 commit comments

Comments
 (0)