Skip to content

Commit 2ede4b5

Browse files
committed
Verify liveness is working
1 parent a6b72bc commit 2ede4b5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/lib/Target/RISCV/RISCVLiveVariables.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,13 @@ void RISCVLiveVariables::computeGlobalLiveness(MachineFunction &MF) {
320320
const MachineBasicBlock &EntryBB = MF.front();
321321
NumLiveRegsAtEntry += BlockLiveness[&EntryBB].LiveIn.size();
322322
}
323+
324+
for (auto &BB : MF) {
325+
auto &computedLivein = BlockLiveness[&BB].LiveIn;
326+
for (auto &LI : BB.getLiveIns()) {
327+
assert(0 && computedLivein.count(LI.PhysReg));
328+
}
329+
}
323330
}
324331

325332
bool RISCVLiveVariables::isLiveAt(Register Reg,

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ void RISCVPassConfig::addPreEmitPass() {
559559
addPass(createRISCVIndirectBranchTrackingPass());
560560
addPass(&BranchRelaxationPassID);
561561
addPass(createRISCVMakeCompressibleOptPass());
562-
addPass(createRISCVLiveVariablesPass());
563562
}
564563

565564
void RISCVPassConfig::addPreEmitPass2() {
@@ -589,7 +588,6 @@ void RISCVPassConfig::addMachineSSAOptimization() {
589588
TargetPassConfig::addMachineSSAOptimization();
590589

591590
if (TM->getTargetTriple().isRISCV64()) {
592-
addPass(createRISCVLiveVariablesPass());
593591
addPass(createRISCVOptWInstrsPass());
594592
}
595593
}
@@ -621,6 +619,8 @@ void RISCVPassConfig::addPostRegAlloc() {
621619
if (TM->getOptLevel() != CodeGenOptLevel::None &&
622620
EnableRedundantCopyElimination)
623621
addPass(createRISCVRedundantCopyEliminationPass());
622+
623+
addPass(createRISCVLiveVariablesPass());
624624
}
625625

626626
bool RISCVPassConfig::addILPOpts() {

0 commit comments

Comments
 (0)