Skip to content

Commit f4e8978

Browse files
author
Tony Linthicum
committed
Address PR 149367 review comments
1 parent cb0ca7e commit f4e8978

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ void RewriteScheduleStage::findReachingDefs(
12451245
Visited.insert(UseMI->getParent());
12461246

12471247
// Mark the predecessor blocks for traversal
1248-
for (auto PredMBB : UseMI->getParent()->predecessors()) {
1248+
for (auto *PredMBB : UseMI->getParent()->predecessors()) {
12491249
Worklist.push_back(PredMBB);
12501250
Visited.insert(PredMBB);
12511251
}
@@ -1266,7 +1266,7 @@ void RewriteScheduleStage::findReachingDefs(
12661266
continue;
12671267
}
12681268

1269-
for (auto PredMBB : DefMBB->predecessors()) {
1269+
for (auto *PredMBB : DefMBB->predecessors()) {
12701270
if (Visited.insert(PredMBB).second)
12711271
Worklist.push_back(PredMBB);
12721272
}
@@ -1966,8 +1966,7 @@ bool RewriteScheduleStage::initHeuristics(
19661966
continue;
19671967

19681968
int ReplacementOp = AMDGPU::getMFMASrcCVDstAGPROp(MI.getOpcode());
1969-
if (ReplacementOp == -1)
1970-
continue;
1969+
assert(ReplacementOp != -1)
19711970

19721971
RewriteCands.push_back({&MI, MI.getOpcode()});
19731972
MI.setDesc(TII->get(ReplacementOp));
@@ -2238,9 +2237,9 @@ bool RewriteScheduleStage::rewrite(
22382237
}
22392238

22402239
if (!Src2DefsReplace.empty()) {
2241-
if (RedefMap.contains(Src2Reg))
2240+
if (RedefMap.contains(Src2Reg)) {
22422241
MappedReg = RedefMap[Src2Reg];
2243-
else {
2242+
} else {
22442243
assert(!ReachingDefCopyMap.contains(Src2Reg));
22452244
const TargetRegisterClass *Src2RC = DAG.MRI.getRegClass(Src2Reg);
22462245
const TargetRegisterClass *VGPRRC =
@@ -2399,7 +2398,7 @@ bool RewriteScheduleStage::rewrite(
23992398
SlotIndex InstPt = DAG.LIS->getInstructionIndex(*OpBegin->getParent());
24002399

24012400
// Find the earliest use in this block.
2402-
for (auto User : RUDst.second) {
2401+
for (auto *User : RUDst.second) {
24032402
SlotIndex NewInstPt = DAG.LIS->getInstructionIndex(*User->getParent());
24042403
if (SlotIndex::isEarlierInstr(NewInstPt, InstPt))
24052404
InstPt = NewInstPt;
@@ -2426,7 +2425,7 @@ bool RewriteScheduleStage::rewrite(
24262425
}
24272426

24282427
// Replace the operand for all users.
2429-
for (auto User : RUDst.second) {
2428+
for (auto *User : RUDst.second) {
24302429
User->setReg(NewUseReg);
24312430
}
24322431

@@ -2443,9 +2442,8 @@ bool RewriteScheduleStage::rewrite(
24432442
Register NewReg = NewDef.second;
24442443

24452444
// Replace the register for any associated operand in the MFMA chain.
2446-
for (MachineOperand *ReplaceOp : ReplaceMap[OldReg]) {
2445+
for (MachineOperand *ReplaceOp : ReplaceMap[OldReg])
24472446
ReplaceOp->setReg(NewReg);
2448-
}
24492447
}
24502448

24512449
// Finally, do the reclassification of the MFMA registers.

llvm/lib/Target/AMDGPU/GCNSchedStrategy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class RewriteScheduleStage : public GCNSchedStage {
429429
const SIRegisterInfo *SRI;
430430

431431
/// Do a speculative rewrite and collect copy locations. The speculative
432-
/// rewrite allows us to calulcate the RP of the code after the rewrite, and
432+
/// rewrite allows us to calculate the RP of the code after the rewrite, and
433433
/// the copy locations allow us to calculate the total cost of copies required
434434
/// for the rewrite. Stores the rewritten instructions in \p RewriteCands ,
435435
/// the copy locations for uses (of the MFMA result) in \p CopyForUse and the

0 commit comments

Comments
 (0)