Skip to content

[NFC][SIWholeQuadMode] Remove redundant arguments #124930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ class SIWholeQuadMode : public MachineFunctionPass {
MachineBasicBlock::iterator Before, Register SavedOrig,
char NonStrictState, char CurrentStrictState);

MachineBasicBlock *splitBlock(MachineBasicBlock *BB, MachineInstr *TermMI);

MachineInstr *lowerKillI1(MachineBasicBlock &MBB, MachineInstr &MI,
bool IsWQM);
MachineInstr *lowerKillF32(MachineBasicBlock &MBB, MachineInstr &MI);
void splitBlock(MachineInstr *TermMI);
MachineInstr *lowerKillI1(MachineInstr &MI, bool IsWQM);
MachineInstr *lowerKillF32(MachineInstr &MI);

void lowerBlock(MachineBasicBlock &MBB, BlockInfo &BI);
void processBlock(MachineBasicBlock &MBB, BlockInfo &BI, bool IsEntry);
Expand Down Expand Up @@ -746,8 +744,8 @@ SIWholeQuadMode::saveSCC(MachineBasicBlock &MBB,
return Restore;
}

MachineBasicBlock *SIWholeQuadMode::splitBlock(MachineBasicBlock *BB,
MachineInstr *TermMI) {
void SIWholeQuadMode::splitBlock(MachineInstr *TermMI) {
MachineBasicBlock *BB = TermMI->getParent();
LLVM_DEBUG(dbgs() << "Split block " << printMBBReference(*BB) << " @ "
<< *TermMI << "\n");

Expand Down Expand Up @@ -796,12 +794,9 @@ MachineBasicBlock *SIWholeQuadMode::splitBlock(MachineBasicBlock *BB,
.addMBB(SplitBB);
LIS->InsertMachineInstrInMaps(*MI);
}

return SplitBB;
}

MachineInstr *SIWholeQuadMode::lowerKillF32(MachineBasicBlock &MBB,
MachineInstr &MI) {
MachineInstr *SIWholeQuadMode::lowerKillF32(MachineInstr &MI) {
assert(LiveMaskReg.isVirtual());

const DebugLoc &DL = MI.getDebugLoc();
Expand Down Expand Up @@ -869,6 +864,8 @@ MachineInstr *SIWholeQuadMode::lowerKillF32(MachineBasicBlock &MBB,
llvm_unreachable("invalid ISD:SET cond code");
}

MachineBasicBlock &MBB = *MI.getParent();

// Pick opcode based on comparison type.
MachineInstr *VcmpMI;
const MachineOperand &Op0 = MI.getOperand(0);
Expand Down Expand Up @@ -919,10 +916,11 @@ MachineInstr *SIWholeQuadMode::lowerKillF32(MachineBasicBlock &MBB,
return NewTerm;
}

MachineInstr *SIWholeQuadMode::lowerKillI1(MachineBasicBlock &MBB,
MachineInstr &MI, bool IsWQM) {
MachineInstr *SIWholeQuadMode::lowerKillI1(MachineInstr &MI, bool IsWQM) {
assert(LiveMaskReg.isVirtual());

MachineBasicBlock &MBB = *MI.getParent();

const DebugLoc &DL = MI.getDebugLoc();
MachineInstr *MaskUpdateMI = nullptr;

Expand Down Expand Up @@ -1055,10 +1053,10 @@ void SIWholeQuadMode::lowerBlock(MachineBasicBlock &MBB, BlockInfo &BI) {
switch (MI.getOpcode()) {
case AMDGPU::SI_DEMOTE_I1:
case AMDGPU::SI_KILL_I1_TERMINATOR:
SplitPoint = lowerKillI1(MBB, MI, State == StateWQM);
SplitPoint = lowerKillI1(MI, State == StateWQM);
break;
case AMDGPU::SI_KILL_F32_COND_IMM_TERMINATOR:
SplitPoint = lowerKillF32(MBB, MI);
SplitPoint = lowerKillF32(MI);
break;
case AMDGPU::ENTER_STRICT_WWM:
ActiveLanesReg = MI.getOperand(0).getReg();
Expand All @@ -1084,12 +1082,8 @@ void SIWholeQuadMode::lowerBlock(MachineBasicBlock &MBB, BlockInfo &BI) {
}

// Perform splitting after instruction scan to simplify iteration.
if (!SplitPoints.empty()) {
MachineBasicBlock *BB = &MBB;
for (MachineInstr *MI : SplitPoints) {
BB = splitBlock(BB, MI);
}
}
for (MachineInstr *MI : SplitPoints)
splitBlock(MI);
}

// Return an iterator in the (inclusive) range [First, Last] at which
Expand Down Expand Up @@ -1546,19 +1540,18 @@ bool SIWholeQuadMode::lowerCopyInstrs() {

bool SIWholeQuadMode::lowerKillInstrs(bool IsWQM) {
for (MachineInstr *MI : KillInstrs) {
MachineBasicBlock *MBB = MI->getParent();
MachineInstr *SplitPoint = nullptr;
switch (MI->getOpcode()) {
case AMDGPU::SI_DEMOTE_I1:
case AMDGPU::SI_KILL_I1_TERMINATOR:
SplitPoint = lowerKillI1(*MBB, *MI, IsWQM);
SplitPoint = lowerKillI1(*MI, IsWQM);
break;
case AMDGPU::SI_KILL_F32_COND_IMM_TERMINATOR:
SplitPoint = lowerKillF32(*MBB, *MI);
SplitPoint = lowerKillF32(*MI);
break;
}
if (SplitPoint)
splitBlock(MBB, SplitPoint);
splitBlock(SplitPoint);
}
return !KillInstrs.empty();
}
Expand Down