Skip to content

Commit 1e45bf4

Browse files
committed
[CodeGen][NewPM] Port LiveIntervals to new pass manager
- Add `LiveIntervalsAnalysis`. - Add `LiveIntervalsPrinterPass`. - Use `LiveIntervalsWrapperPass` in legacy pass manager. This would be the last analysis required by `PHIElimination`.
1 parent a77d3ea commit 1e45bf4

File tree

59 files changed

+918
-761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+918
-761
lines changed

llvm/include/llvm/CodeGen/LiveIntervals.h

Lines changed: 485 additions & 437 deletions
Large diffs are not rendered by default.

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &);
151151
void initializeGISelKnownBitsAnalysisPass(PassRegistry &);
152152
void initializeLiveDebugValuesPass(PassRegistry&);
153153
void initializeLiveDebugVariablesPass(PassRegistry&);
154-
void initializeLiveIntervalsPass(PassRegistry&);
154+
void initializeLiveIntervalsWrapperPassPass(PassRegistry &);
155155
void initializeLiveRangeShrinkPass(PassRegistry&);
156156
void initializeLiveRegMatrixPass(PassRegistry&);
157157
void initializeLiveStacksPass(PassRegistry&);

llvm/include/llvm/Passes/CodeGenPassBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "llvm/CodeGen/InterleavedAccess.h"
3737
#include "llvm/CodeGen/InterleavedLoadCombine.h"
3838
#include "llvm/CodeGen/JMCInstrumenter.h"
39+
#include "llvm/CodeGen/LiveIntervals.h"
3940
#include "llvm/CodeGen/LocalStackSlotAllocation.h"
4041
#include "llvm/CodeGen/LowerEmuTLS.h"
4142
#include "llvm/CodeGen/MIRPrinter.h"
@@ -1106,7 +1107,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addOptimizedRegAlloc(
11061107

11071108
// Eventually, we want to run LiveIntervals before PHI elimination.
11081109
if (Opt.EarlyLiveIntervals)
1109-
addPass(LiveIntervalsPass());
1110+
addPass(RequireAnalysisPass<LiveIntervalsAnalysis, MachineFunction>());
11101111

11111112
addPass(TwoAddressInstructionPass());
11121113
addPass(RegisterCoalescerPass());

llvm/include/llvm/Passes/MachinePassRegistry.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ LOOP_PASS("loop-reduce", LoopStrengthReducePass())
9494
// LiveVariables can be removed completely, and LiveIntervals can be directly
9595
// computed. (We still either need to regenerate kill flags after regalloc, or
9696
// preferably fix the scavenger to not depend on them).
97+
MACHINE_FUNCTION_ANALYSIS("live-intervals", LiveIntervalsAnalysis())
9798
MACHINE_FUNCTION_ANALYSIS("live-vars", LiveVariablesAnalysis())
9899
MACHINE_FUNCTION_ANALYSIS("machine-branch-prob",
99100
MachineBranchProbabilityAnalysis())
@@ -132,6 +133,7 @@ MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
132133
MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
133134
MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass())
134135
MACHINE_FUNCTION_PASS("print", PrintMIRPass())
136+
MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(dbgs()))
135137
MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(dbgs()))
136138
MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
137139
MachineBranchProbabilityPrinterPass(dbgs()))
@@ -208,7 +210,6 @@ DUMMY_MACHINE_FUNCTION_PASS("irtranslator", IRTranslatorPass)
208210
DUMMY_MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass)
209211
DUMMY_MACHINE_FUNCTION_PASS("legalizer", LegalizerPass)
210212
DUMMY_MACHINE_FUNCTION_PASS("livedebugvalues", LiveDebugValuesPass)
211-
DUMMY_MACHINE_FUNCTION_PASS("liveintervals", LiveIntervalsPass)
212213
DUMMY_MACHINE_FUNCTION_PASS("lrshrink", LiveRangeShrinkPass)
213214
DUMMY_MACHINE_FUNCTION_PASS("machine-combiner", MachineCombinerPass)
214215
DUMMY_MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass)

llvm/lib/CodeGen/CodeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
6060
initializeJMCInstrumenterPass(Registry);
6161
initializeLiveDebugValuesPass(Registry);
6262
initializeLiveDebugVariablesPass(Registry);
63-
initializeLiveIntervalsPass(Registry);
63+
initializeLiveIntervalsWrapperPassPass(Registry);
6464
initializeLiveRangeShrinkPass(Registry);
6565
initializeLiveStacksPass(Registry);
6666
initializeLiveVariablesWrapperPassPass(Registry);

llvm/lib/CodeGen/InlineSpiller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class HoistSpillHelper : private LiveRangeEdit::Delegate {
131131
public:
132132
HoistSpillHelper(MachineFunctionPass &pass, MachineFunction &mf,
133133
VirtRegMap &vrm)
134-
: MF(mf), LIS(pass.getAnalysis<LiveIntervals>()),
134+
: MF(mf), LIS(pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS()),
135135
LSS(pass.getAnalysis<LiveStacks>()),
136136
MDT(pass.getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree()),
137137
VRM(vrm), MRI(mf.getRegInfo()), TII(*mf.getSubtarget().getInstrInfo()),
@@ -188,7 +188,7 @@ class InlineSpiller : public Spiller {
188188
public:
189189
InlineSpiller(MachineFunctionPass &Pass, MachineFunction &MF, VirtRegMap &VRM,
190190
VirtRegAuxInfo &VRAI)
191-
: MF(MF), LIS(Pass.getAnalysis<LiveIntervals>()),
191+
: MF(MF), LIS(Pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS()),
192192
LSS(Pass.getAnalysis<LiveStacks>()),
193193
MDT(Pass.getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree()),
194194
VRM(VRM), MRI(MF.getRegInfo()), TII(*MF.getSubtarget().getInstrInfo()),

llvm/lib/CodeGen/LiveDebugVariables.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ char LiveDebugVariables::ID = 0;
7979
INITIALIZE_PASS_BEGIN(LiveDebugVariables, DEBUG_TYPE,
8080
"Debug Variable Analysis", false, false)
8181
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
82-
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
82+
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
8383
INITIALIZE_PASS_END(LiveDebugVariables, DEBUG_TYPE,
8484
"Debug Variable Analysis", false, false)
8585

8686
void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const {
8787
AU.addRequired<MachineDominatorTreeWrapperPass>();
88-
AU.addRequiredTransitive<LiveIntervals>();
88+
AU.addRequiredTransitive<LiveIntervalsWrapperPass>();
8989
AU.setPreservesAll();
9090
MachineFunctionPass::getAnalysisUsage(AU);
9191
}
@@ -1263,7 +1263,7 @@ void LDVImpl::computeIntervals() {
12631263
bool LDVImpl::runOnMachineFunction(MachineFunction &mf, bool InstrRef) {
12641264
clear();
12651265
MF = &mf;
1266-
LIS = &pass.getAnalysis<LiveIntervals>();
1266+
LIS = &pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS();
12671267
TRI = mf.getSubtarget().getRegisterInfo();
12681268
LLVM_DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: "
12691269
<< mf.getName() << " **********\n");

llvm/lib/CodeGen/LiveIntervals.cpp

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,39 @@ using namespace llvm;
5757

5858
#define DEBUG_TYPE "regalloc"
5959

60-
char LiveIntervals::ID = 0;
61-
char &llvm::LiveIntervalsID = LiveIntervals::ID;
62-
INITIALIZE_PASS_BEGIN(LiveIntervals, "liveintervals", "Live Interval Analysis",
63-
false, false)
60+
AnalysisKey LiveIntervalsAnalysis::Key;
61+
62+
LiveIntervalsAnalysis::Result
63+
LiveIntervalsAnalysis::run(MachineFunction &MF,
64+
MachineFunctionAnalysisManager &MFAM) {
65+
return Result(MF, MFAM.getResult<SlotIndexesAnalysis>(MF),
66+
MFAM.getResult<MachineDominatorTreeAnalysis>(MF));
67+
}
68+
69+
PreservedAnalyses
70+
LiveIntervalsPrinterPass::run(MachineFunction &MF,
71+
MachineFunctionAnalysisManager &MFAM) {
72+
OS << "Live intervals for machine function: " << MF.getName() << ":\n";
73+
MFAM.getResult<LiveIntervalsAnalysis>(MF).print(OS);
74+
return PreservedAnalyses::all();
75+
}
76+
77+
char LiveIntervalsWrapperPass::ID = 0;
78+
char &llvm::LiveIntervalsID = LiveIntervalsWrapperPass::ID;
79+
INITIALIZE_PASS_BEGIN(LiveIntervalsWrapperPass, "liveintervals",
80+
"Live Interval Analysis", false, false)
6481
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
6582
INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
66-
INITIALIZE_PASS_END(LiveIntervals, "liveintervals",
67-
"Live Interval Analysis", false, false)
83+
INITIALIZE_PASS_END(LiveIntervalsWrapperPass, "liveintervals",
84+
"Live Interval Analysis", false, false)
85+
86+
bool LiveIntervalsWrapperPass::runOnMachineFunction(MachineFunction &MF) {
87+
LIS.Indexes = &getAnalysis<SlotIndexesWrapperPass>().getSI();
88+
LIS.DomTree = &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
89+
LIS.analyze(MF);
90+
LLVM_DEBUG(dump());
91+
return false;
92+
}
6893

6994
#ifndef NDEBUG
7095
static cl::opt<bool> EnablePrecomputePhysRegs(
@@ -83,7 +108,7 @@ cl::opt<bool> UseSegmentSetForPhysRegs(
83108

84109
} // end namespace llvm
85110

86-
void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
111+
void LiveIntervalsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
87112
AU.setPreservesCFG();
88113
AU.addPreserved<LiveVariablesWrapperPass>();
89114
AU.addPreservedID(MachineLoopInfoID);
@@ -94,13 +119,13 @@ void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
94119
MachineFunctionPass::getAnalysisUsage(AU);
95120
}
96121

97-
LiveIntervals::LiveIntervals() : MachineFunctionPass(ID) {
98-
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
122+
LiveIntervalsWrapperPass::LiveIntervalsWrapperPass() : MachineFunctionPass(ID) {
123+
initializeLiveIntervalsWrapperPassPass(*PassRegistry::getPassRegistry());
99124
}
100125

101-
LiveIntervals::~LiveIntervals() { delete LICalc; }
126+
LiveIntervals::~LiveIntervals() { clear(); }
102127

103-
void LiveIntervals::releaseMemory() {
128+
void LiveIntervals::clear() {
104129
// Free the live intervals themselves.
105130
for (unsigned i = 0, e = VirtRegIntervals.size(); i != e; ++i)
106131
delete VirtRegIntervals[Register::index2VirtReg(i)];
@@ -117,16 +142,14 @@ void LiveIntervals::releaseMemory() {
117142
VNInfoAllocator.Reset();
118143
}
119144

120-
bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
145+
void LiveIntervals::analyze(MachineFunction &fn) {
121146
MF = &fn;
122147
MRI = &MF->getRegInfo();
123148
TRI = MF->getSubtarget().getRegisterInfo();
124149
TII = MF->getSubtarget().getInstrInfo();
125-
Indexes = &getAnalysis<SlotIndexesWrapperPass>().getSI();
126-
DomTree = &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
127150

128151
if (!LICalc)
129-
LICalc = new LiveIntervalCalc();
152+
LICalc = std::make_unique<LiveIntervalCalc>();
130153

131154
// Allocate space for all virtual registers.
132155
VirtRegIntervals.resize(MRI->getNumVirtRegs());
@@ -141,11 +164,9 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
141164
for (unsigned i = 0, e = TRI->getNumRegUnits(); i != e; ++i)
142165
getRegUnit(i);
143166
}
144-
LLVM_DEBUG(dump());
145-
return false;
146167
}
147168

148-
void LiveIntervals::print(raw_ostream &OS, const Module* ) const {
169+
void LiveIntervals::print(raw_ostream &OS) const {
149170
OS << "********** INTERVALS **********\n";
150171

151172
// Dump the regunits.
@@ -179,6 +200,10 @@ LLVM_DUMP_METHOD void LiveIntervals::dumpInstrs() const {
179200
}
180201
#endif
181202

203+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
204+
LLVM_DUMP_METHOD void LiveIntervals::dump() const { print(dbgs()); }
205+
#endif
206+
182207
LiveInterval *LiveIntervals::createInterval(Register reg) {
183208
float Weight = reg.isPhysical() ? huge_valf : 0.0F;
184209
return new LiveInterval(reg, Weight);

llvm/lib/CodeGen/LiveRegMatrix.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ STATISTIC(NumUnassigned , "Number of registers unassigned");
3838
char LiveRegMatrix::ID = 0;
3939
INITIALIZE_PASS_BEGIN(LiveRegMatrix, "liveregmatrix",
4040
"Live Register Matrix", false, false)
41-
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
41+
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
4242
INITIALIZE_PASS_DEPENDENCY(VirtRegMap)
4343
INITIALIZE_PASS_END(LiveRegMatrix, "liveregmatrix",
4444
"Live Register Matrix", false, false)
@@ -47,14 +47,14 @@ LiveRegMatrix::LiveRegMatrix() : MachineFunctionPass(ID) {}
4747

4848
void LiveRegMatrix::getAnalysisUsage(AnalysisUsage &AU) const {
4949
AU.setPreservesAll();
50-
AU.addRequiredTransitive<LiveIntervals>();
50+
AU.addRequiredTransitive<LiveIntervalsWrapperPass>();
5151
AU.addRequiredTransitive<VirtRegMap>();
5252
MachineFunctionPass::getAnalysisUsage(AU);
5353
}
5454

5555
bool LiveRegMatrix::runOnMachineFunction(MachineFunction &MF) {
5656
TRI = MF.getSubtarget().getRegisterInfo();
57-
LIS = &getAnalysis<LiveIntervals>();
57+
LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
5858
VRM = &getAnalysis<VirtRegMap>();
5959

6060
unsigned NumRegUnits = TRI->getNumRegUnits();

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,8 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
11611161
<< " -- " << printMBBReference(*NMBB) << " -- "
11621162
<< printMBBReference(*Succ) << '\n');
11631163

1164-
LiveIntervals *LIS = P.getAnalysisIfAvailable<LiveIntervals>();
1164+
auto *LISWrapper = P.getAnalysisIfAvailable<LiveIntervalsWrapperPass>();
1165+
LiveIntervals *LIS = LISWrapper ? &LISWrapper->getLIS() : nullptr;
11651166
auto *SIWrapper = P.getAnalysisIfAvailable<SlotIndexesWrapperPass>();
11661167
SlotIndexes *Indexes = SIWrapper ? &SIWrapper->getSI() : nullptr;
11671168
if (LIS)

llvm/lib/CodeGen/MachinePipeliner.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ INITIALIZE_PASS_BEGIN(MachinePipeliner, DEBUG_TYPE,
236236
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
237237
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfoWrapperPass)
238238
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
239-
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
239+
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
240240
INITIALIZE_PASS_END(MachinePipeliner, DEBUG_TYPE,
241241
"Modulo Software Pipelining", false, false)
242242

@@ -437,7 +437,8 @@ bool MachinePipeliner::canPipelineLoop(MachineLoop &L) {
437437

438438
void MachinePipeliner::preprocessPhiNodes(MachineBasicBlock &B) {
439439
MachineRegisterInfo &MRI = MF->getRegInfo();
440-
SlotIndexes &Slots = *getAnalysis<LiveIntervals>().getSlotIndexes();
440+
SlotIndexes &Slots =
441+
*getAnalysis<LiveIntervalsWrapperPass>().getLIS().getSlotIndexes();
441442

442443
for (MachineInstr &PI : B.phis()) {
443444
MachineOperand &DefOp = PI.getOperand(0);
@@ -472,8 +473,9 @@ void MachinePipeliner::preprocessPhiNodes(MachineBasicBlock &B) {
472473
bool MachinePipeliner::swingModuloScheduler(MachineLoop &L) {
473474
assert(L.getBlocks().size() == 1 && "SMS works on single blocks only.");
474475

475-
SwingSchedulerDAG SMS(*this, L, getAnalysis<LiveIntervals>(), RegClassInfo,
476-
II_setByPragma, LI.LoopPipelinerInfo.get());
476+
SwingSchedulerDAG SMS(
477+
*this, L, getAnalysis<LiveIntervalsWrapperPass>().getLIS(), RegClassInfo,
478+
II_setByPragma, LI.LoopPipelinerInfo.get());
477479

478480
MachineBasicBlock *MBB = L.getHeader();
479481
// The kernel should not include any terminator instructions. These
@@ -501,7 +503,7 @@ void MachinePipeliner::getAnalysisUsage(AnalysisUsage &AU) const {
501503
AU.addPreserved<AAResultsWrapperPass>();
502504
AU.addRequired<MachineLoopInfoWrapperPass>();
503505
AU.addRequired<MachineDominatorTreeWrapperPass>();
504-
AU.addRequired<LiveIntervals>();
506+
AU.addRequired<LiveIntervalsWrapperPass>();
505507
AU.addRequired<MachineOptimizationRemarkEmitterPass>();
506508
AU.addRequired<TargetPassConfig>();
507509
MachineFunctionPass::getAnalysisUsage(AU);
@@ -514,7 +516,7 @@ bool MachinePipeliner::runWindowScheduler(MachineLoop &L) {
514516
Context.MDT = MDT;
515517
Context.PassConfig = &getAnalysis<TargetPassConfig>();
516518
Context.AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
517-
Context.LIS = &getAnalysis<LiveIntervals>();
519+
Context.LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
518520
Context.RegClassInfo->runOnMachineFunction(*MF);
519521
WindowScheduler WS(&Context, L);
520522
return WS.run();

llvm/lib/CodeGen/MachineScheduler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
269269
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
270270
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfoWrapperPass)
271271
INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
272-
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
272+
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
273273
INITIALIZE_PASS_END(MachineScheduler, DEBUG_TYPE,
274274
"Machine Instruction Scheduler", false, false)
275275

@@ -285,8 +285,8 @@ void MachineScheduler::getAnalysisUsage(AnalysisUsage &AU) const {
285285
AU.addRequired<TargetPassConfig>();
286286
AU.addRequired<SlotIndexesWrapperPass>();
287287
AU.addPreserved<SlotIndexesWrapperPass>();
288-
AU.addRequired<LiveIntervals>();
289-
AU.addPreserved<LiveIntervals>();
288+
AU.addRequired<LiveIntervalsWrapperPass>();
289+
AU.addPreserved<LiveIntervalsWrapperPass>();
290290
MachineFunctionPass::getAnalysisUsage(AU);
291291
}
292292

@@ -449,7 +449,7 @@ bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) {
449449
PassConfig = &getAnalysis<TargetPassConfig>();
450450
AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
451451

452-
LIS = &getAnalysis<LiveIntervals>();
452+
LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
453453

454454
if (VerifyScheduling) {
455455
LLVM_DEBUG(LIS->dump());

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace {
316316
AU.addUsedIfAvailable<LiveStacks>();
317317
AU.addUsedIfAvailable<LiveVariablesWrapperPass>();
318318
AU.addUsedIfAvailable<SlotIndexesWrapperPass>();
319-
AU.addUsedIfAvailable<LiveIntervals>();
319+
AU.addUsedIfAvailable<LiveIntervalsWrapperPass>();
320320
AU.setPreservesAll();
321321
MachineFunctionPass::getAnalysisUsage(AU);
322322
}
@@ -428,7 +428,8 @@ unsigned MachineVerifier::verify(const MachineFunction &MF) {
428428
MachineFunctionProperties::Property::TracksDebugUserValues);
429429

430430
if (PASS) {
431-
LiveInts = PASS->getAnalysisIfAvailable<LiveIntervals>();
431+
auto *LISWrapper = PASS->getAnalysisIfAvailable<LiveIntervalsWrapperPass>();
432+
LiveInts = LISWrapper ? &LISWrapper->getLIS() : nullptr;
432433
// We don't want to verify LiveVariables if LiveIntervals is available.
433434
auto *LVWrapper = PASS->getAnalysisIfAvailable<LiveVariablesWrapperPass>();
434435
if (!LiveInts)

llvm/lib/CodeGen/ModuloSchedule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ class ModuloScheduleTest : public MachineFunctionPass {
27642764

27652765
void getAnalysisUsage(AnalysisUsage &AU) const override {
27662766
AU.addRequired<MachineLoopInfoWrapperPass>();
2767-
AU.addRequired<LiveIntervals>();
2767+
AU.addRequired<LiveIntervalsWrapperPass>();
27682768
MachineFunctionPass::getAnalysisUsage(AU);
27692769
}
27702770
};
@@ -2775,7 +2775,7 @@ char ModuloScheduleTest::ID = 0;
27752775
INITIALIZE_PASS_BEGIN(ModuloScheduleTest, "modulo-schedule-test",
27762776
"Modulo Schedule test pass", false, false)
27772777
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfoWrapperPass)
2778-
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
2778+
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
27792779
INITIALIZE_PASS_END(ModuloScheduleTest, "modulo-schedule-test",
27802780
"Modulo Schedule test pass", false, false)
27812781

@@ -2810,7 +2810,7 @@ static void parseSymbolString(StringRef S, int &Cycle, int &Stage) {
28102810
}
28112811

28122812
void ModuloScheduleTest::runOnLoop(MachineFunction &MF, MachineLoop &L) {
2813-
LiveIntervals &LIS = getAnalysis<LiveIntervals>();
2813+
LiveIntervals &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS();
28142814
MachineBasicBlock *BB = L.getTopBlock();
28152815
dbgs() << "--- ModuloScheduleTest running on BB#" << BB->getNumber() << "\n";
28162816

llvm/lib/CodeGen/PHIElimination.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const {
139139
AU.addUsedIfAvailable<LiveVariablesWrapperPass>();
140140
AU.addPreserved<LiveVariablesWrapperPass>();
141141
AU.addPreserved<SlotIndexesWrapperPass>();
142-
AU.addPreserved<LiveIntervals>();
142+
AU.addPreserved<LiveIntervalsWrapperPass>();
143143
AU.addPreserved<MachineDominatorTreeWrapperPass>();
144144
AU.addPreserved<MachineLoopInfoWrapperPass>();
145145
MachineFunctionPass::getAnalysisUsage(AU);
@@ -149,7 +149,8 @@ bool PHIElimination::runOnMachineFunction(MachineFunction &MF) {
149149
MRI = &MF.getRegInfo();
150150
auto *LVWrapper = getAnalysisIfAvailable<LiveVariablesWrapperPass>();
151151
LV = LVWrapper ? &LVWrapper->getLV() : nullptr;
152-
LIS = getAnalysisIfAvailable<LiveIntervals>();
152+
auto *LISWrapper = getAnalysisIfAvailable<LiveIntervalsWrapperPass>();
153+
LIS = LISWrapper ? &LISWrapper->getLIS() : nullptr;
153154

154155
bool Changed = false;
155156

0 commit comments

Comments
 (0)