Skip to content

Commit 660981e

Browse files
committed
Verify liveness is working
1 parent 98715b6 commit 660981e

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
@@ -564,7 +564,6 @@ void RISCVPassConfig::addPreEmitPass() {
564564
addPass(createRISCVIndirectBranchTrackingPass());
565565
addPass(&BranchRelaxationPassID);
566566
addPass(createRISCVMakeCompressibleOptPass());
567-
addPass(createRISCVLiveVariablesPass());
568567
}
569568

570569
void RISCVPassConfig::addPreEmitPass2() {
@@ -597,7 +596,6 @@ void RISCVPassConfig::addMachineSSAOptimization() {
597596
TargetPassConfig::addMachineSSAOptimization();
598597

599598
if (TM->getTargetTriple().isRISCV64()) {
600-
addPass(createRISCVLiveVariablesPass());
601599
addPass(createRISCVOptWInstrsPass());
602600
}
603601
}
@@ -629,6 +627,8 @@ void RISCVPassConfig::addPostRegAlloc() {
629627
if (TM->getOptLevel() != CodeGenOptLevel::None &&
630628
EnableRedundantCopyElimination)
631629
addPass(createRISCVRedundantCopyEliminationPass());
630+
631+
addPass(createRISCVLiveVariablesPass());
632632
}
633633

634634
bool RISCVPassConfig::addILPOpts() {

0 commit comments

Comments
 (0)