Skip to content

Commit 5ffcd9a

Browse files
committed
Return true when kill information is updated
1 parent 1ca0332 commit 5ffcd9a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

llvm/lib/Target/RISCV/RISCVLiveVariables.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class RISCVLiveVariables : public MachineFunctionPass {
112112
void verifyLiveness(MachineFunction &MF) const;
113113

114114
/// Mark operands that kill a register
115-
void markKills(MachineFunction &MF);
115+
bool markKills(MachineFunction &MF);
116116

117117
private:
118118
/// Compute local liveness information (Use and Def sets) for each block
@@ -380,7 +380,8 @@ void RISCVLiveVariables::verifyLiveness(MachineFunction &MF) const {
380380
}
381381
}
382382

383-
void RISCVLiveVariables::markKills(MachineFunction &MF) {
383+
bool RISCVLiveVariables::markKills(MachineFunction &MF) {
384+
bool Changed = false;
384385
auto KillSetSize = PreRegAlloc ? RegCounter : TRI->getNumRegs();
385386
for (MachineBasicBlock *MBB : post_order(&MF)) {
386387
// Set all the registers that are not live-out of the block.
@@ -427,8 +428,10 @@ void RISCVLiveVariables::markKills(MachineFunction &MF) {
427428
auto RegIdx = PreRegAlloc ? TrackedRegisters[Reg] : Reg.asMCReg().id();
428429

429430
if (KillSet[RegIdx]) {
430-
if (!MO.isKill() && !MI.isPHI())
431+
if (!MO.isKill() && !MI.isPHI()) {
431432
MO.setIsKill(true);
433+
Changed = true;
434+
}
432435
LLVM_DEBUG(dbgs() << "Marking kill of " << printReg(Reg, TRI)
433436
<< " at instruction: " << MI);
434437
KillSet.reset(RegIdx);
@@ -440,6 +443,7 @@ void RISCVLiveVariables::markKills(MachineFunction &MF) {
440443
}
441444
}
442445
}
446+
return Changed;
443447
}
444448

445449
bool RISCVLiveVariables::runOnMachineFunction(MachineFunction &MF) {
@@ -472,9 +476,10 @@ bool RISCVLiveVariables::runOnMachineFunction(MachineFunction &MF) {
472476

473477
// TODO: Update live-in/live-out sets of MBBs
474478

479+
bool Changed = false;
475480
// Step 3: Mark kill flags on operands
476481
if (UpdateKills && MaxVRegs >= RegCounter)
477-
markKills(MF);
482+
Changed = markKills(MF);
478483

479484
LLVM_DEBUG({
480485
dbgs() << "\n***** Final Liveness Information *****\n";
@@ -483,7 +488,7 @@ bool RISCVLiveVariables::runOnMachineFunction(MachineFunction &MF) {
483488

484489
verifyLiveness(MF);
485490
// This is an analysis pass, it doesn't modify the function
486-
return false;
491+
return Changed;
487492
}
488493

489494
void RISCVLiveVariables::print(raw_ostream &OS, const Module *M) const {

0 commit comments

Comments
 (0)