Skip to content

Commit f8eb7fb

Browse files
committed
More cleanups
1 parent d8b6711 commit f8eb7fb

File tree

4 files changed

+619
-626
lines changed

4 files changed

+619
-626
lines changed

llvm/lib/Target/AMDGPU/AMDGPUHotBlockRematerialize.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ bool isSafeToMove(MachineInstr *DefMI, MachineRegisterInfo &MRI) {
226226
if (!Op.isReg())
227227
continue;
228228
if (!MRI.getUniqueVRegDef(Op.getReg()) &&
229-
!llvm::IsSub0Sub1SingleDef(Op.getReg(), MRI)) {
229+
!llvm::isSub0Sub1SingleDef(Op.getReg(), MRI)) {
230230
return false;
231231
}
232232
}
@@ -280,7 +280,7 @@ unsigned collectMBBPressure(MachineBasicBlock &MBB, LiveIntervals *LIS,
280280
GCNUpwardRPTracker RPTracker(*LIS);
281281
// R.End doesn't point to the boundary instruction.
282282
// Skip Debug instr.
283-
if (!llvm::GetNonDebugMBBEnd(BBEnd, MBB))
283+
if (!llvm::getNonDebugMBBEnd(BBEnd, MBB))
284284
return ST->getOccupancyWithNumVGPRs(0);
285285

286286
GCNRPTracker::LiveRegSet OutputLive = Status.MBBOutputLiveMap[&MBB];
@@ -327,7 +327,7 @@ unsigned collectFnPressure(MachineFunction &MF, LiveIntervals *LIS,
327327

328328
// R.End doesn't point to the boundary instruction.
329329
// Skip Debug instr.
330-
if (llvm::GetNonDebugMBBEnd(BBEnd, MBB)) {
330+
if (llvm::getNonDebugMBBEnd(BBEnd, MBB)) {
331331
auto SI = SlotIndexes->getInstructionIndex(*BBEnd);
332332
MBBOutputSlotMap[&MBB] = SI;
333333
}
@@ -417,7 +417,7 @@ RematStatus getRematStatus(MachineFunction &MF, MachineLoopInfo *MLI,
417417
unsigned STgtOcc = ST->getOccupancyWithNumSGPRs(MaxSPressure);
418418
unsigned VTgtOcc = ST->getOccupancyWithNumVGPRs(MaxVPressure);
419419

420-
llvm::SchedScore TotalScore = llvm::CollectLatency(MF, *ST, MLI);
420+
llvm::SchedScore TotalScore = llvm::collectLatency(MF, *ST, MLI);
421421
bool MemBound =
422422
TotalScore.isMemBound(TgtOcc, std::max(STgtOcc, VTgtOcc) - TgtOcc);
423423

@@ -702,7 +702,7 @@ int rematGain(MachineInstr *DefMI, unsigned Reg, const MachineRegisterInfo &MRI,
702702
}
703703
bool IsSingleDef = MRI.hasOneDef(Reg);
704704
if (!IsSingleDef) {
705-
IsSingleDef = llvm::IsSub0Sub1SingleDef(Reg, MRI);
705+
IsSingleDef = llvm::isSub0Sub1SingleDef(Reg, MRI);
706706
}
707707

708708
if (IsSingleDef) {
@@ -1066,7 +1066,7 @@ static MachineBasicBlock::iterator adjustInsertPointToAvoidSccSmash(
10661066
const bool WillSmashScc =
10671067
InstructionToMove->modifiesRegister(AMDGPU::SCC, SIRI);
10681068
if (WillSmashScc) {
1069-
CurrentInsertPoint = llvm::FindOrCreateInsertionPointForSccDef(
1069+
CurrentInsertPoint = llvm::findOrCreateInsertionPointForSccDef(
10701070
MBB, CurrentInsertPoint, SIRI, SIII, &MRI);
10711071
}
10721072

@@ -1081,7 +1081,7 @@ static MachineBasicBlock::iterator adjustInsertPointForSubExpToAvoidSccSmash(
10811081
const SIRegisterInfo *SIRI, const SIInstrInfo *SIII) {
10821082
const bool WillSmashScc = SubExpToMove.modifiesRegister(AMDGPU::SCC, SIRI);
10831083
if (WillSmashScc) {
1084-
CurrentInsertPoint = llvm::FindOrCreateInsertionPointForSccDef(
1084+
CurrentInsertPoint = llvm::findOrCreateInsertionPointForSccDef(
10851085
MBB, CurrentInsertPoint, SIRI, SIII, &MRI);
10861086
}
10871087

@@ -1094,7 +1094,7 @@ static bool willSmashSccAtLocation(MachineInstr *MI, MachineBasicBlock *MBB,
10941094
// It is ok to pass nullptr to `modifiesRegister` for TRI here since
10951095
// SCC has no subreg/suprereg relationships.
10961096
return MI->modifiesRegister(AMDGPU::SCC, nullptr) &&
1097-
llvm::IsSccLiveAt(MBB, Location);
1097+
llvm::isSccLiveAt(MBB, Location);
10981098
}
10991099

11001100
void applyCloneRemat(Remat *Remat, RematNode &Node,
@@ -1374,7 +1374,7 @@ bool hotBlockRemat(Remat *Remat, MachineFunction &MF, MachineLoopInfo *MLI,
13741374
const GCNRPTracker::LiveRegSet &LiveSet = LISLR;
13751375
unsigned VPressure = 0;
13761376
unsigned SPressure = 0;
1377-
CollectLiveSetPressure(LiveSet, MRI, SIRI, VPressure, SPressure);
1377+
collectLiveSetPressure(LiveSet, MRI, SIRI, VPressure, SPressure);
13781378
if (MaxVPressure < VPressure)
13791379
MaxVPressure = VPressure;
13801380
if (MaxSPressure < SPressure)
@@ -1635,7 +1635,7 @@ bool isSafeCandidate(Remat *Remat, Register Reg, const MachineRegisterInfo &MRI,
16351635
if (OpReg.isPhysical())
16361636
return false;
16371637
if (!MRI.getUniqueVRegDef(OpReg) &&
1638-
!llvm::IsSub0Sub1SingleDef(OpReg, MRI)) {
1638+
!llvm::isSub0Sub1SingleDef(OpReg, MRI)) {
16391639
return false;
16401640
}
16411641
}
@@ -1794,7 +1794,7 @@ std::vector<SubExp> buildSubExpFromCandidates(
17941794
continue;
17951795

17961796
MachineInstr *DefMI = MRI.getUniqueVRegDef(Reg);
1797-
assert((DefMI || llvm::IsSub0Sub1SingleDef(Reg, MRI)) &&
1797+
assert((DefMI || llvm::isSub0Sub1SingleDef(Reg, MRI)) &&
17981798
"UseMI should be safe to move");
17991799
if (DefMI && CandidateDefs.count(DefMI) > 0)
18001800
continue;
@@ -1982,7 +1982,7 @@ std::vector<SubExp> buildSubExpFromCandidatesTopBottom(
19821982
if (Candidates.count(Reg) == 0 && LocalCandidates.count(Reg) != 0)
19831983
continue;
19841984
}
1985-
assert((DefMI || llvm::IsSub0Sub1SingleDef(Reg, MRI)) &&
1985+
assert((DefMI || llvm::isSub0Sub1SingleDef(Reg, MRI)) &&
19861986
"UseMI should be safe to move");
19871987
if (DefMI && CandidateDefs.count(DefMI) > 0)
19881988
continue;
@@ -2361,7 +2361,7 @@ void applySubExpCloneNearUser(SubExp &Exp, std::vector<HotBlock> &HotBlocks,
23612361
DenseMap<unsigned, unsigned> RegMap;
23622362
auto InsertPtr = MBB->getFirstNonPHI();
23632363
// If Exp has scc read/write, make sure MBB not have scc in liveins.
2364-
if (IsModifiesScc && llvm::IsSccLiveAt(MBB, InsertPtr))
2364+
if (IsModifiesScc && llvm::isSccLiveAt(MBB, InsertPtr))
23652365
continue;
23662366
MachineFunction *MF = MBB->getParent();
23672367
for (auto It = Exp.SUnits.begin(); It != Exp.SUnits.end(); It++) {
@@ -2470,7 +2470,7 @@ void applySubExpCloneNearUserInBlock(
24702470
continue;
24712471

24722472
// Do not overwrite a live scc.
2473-
if (IsModifiesScc && llvm::IsSccLiveAt(UserBB, &UseMI))
2473+
if (IsModifiesScc && llvm::isSccLiveAt(UserBB, &UseMI))
24742474
continue;
24752475

24762476
UseMIs.emplace_back(&UseMI);
@@ -3147,7 +3147,7 @@ bool tryRemat(MachineBasicBlock &MBB, MachineInstr *HotMi,
31473147
if (SubExp.SOutputSize == 0)
31483148
continue;
31493149
}
3150-
if (!SubExp.isSafeToMove(MRI, /*IsMoveUp*/ false))
3150+
if (!SubExp.isSafeToMove(MRI))
31513151
continue;
31523152
// Not clone .
31533153
if (SubExp.SUnits.size() > 10)
@@ -3410,7 +3410,7 @@ bool canHelpPressureWhenSink(SubExp &SubExp,
34103410
MachineDominatorTree *DT, bool IsCanClone,
34113411
bool IsSgprBound) {
34123412
LLVM_DEBUG(SubExp.dump(MRI, SIRI));
3413-
if (!SubExp.isSafeToMove(MRI, /*IsMoveUp*/ false))
3413+
if (!SubExp.isSafeToMove(MRI))
34143414
return false;
34153415

34163416
// Update input size to ignore lives in which already in
@@ -3477,7 +3477,7 @@ bool canHelpPressureWhenSink(SubExp &SubExp,
34773477

34783478
bool canHelpPressureWhenHoist(SubExp &SubExp, const MachineRegisterInfo &MRI,
34793479
const MachineLoopInfo *MLI, bool IsSgprBound) {
3480-
if (!SubExp.isSafeToMove(MRI, /*IsMoveUp*/ true))
3480+
if (!SubExp.isSafeToMove(MRI))
34813481
return false;
34823482
if (SubExp.VInputSize < SubExp.VOutputSize)
34833483
return false;
@@ -3722,9 +3722,9 @@ SubExp buildFreeSubExp(SubExp &Exp,
37223722
FreeExp.OutputLive[Reg];
37233723
}
37243724

3725-
CollectLiveSetPressure(FreeExp.InputLive, MRI, SIRI, FreeExp.VInputSize,
3725+
collectLiveSetPressure(FreeExp.InputLive, MRI, SIRI, FreeExp.VInputSize,
37263726
FreeExp.SInputSize);
3727-
CollectLiveSetPressure(FreeExp.OutputLive, MRI, SIRI, FreeExp.VOutputSize,
3727+
collectLiveSetPressure(FreeExp.OutputLive, MRI, SIRI, FreeExp.VOutputSize,
37283728
FreeExp.SOutputSize);
37293729
return FreeExp;
37303730
}
@@ -3779,7 +3779,7 @@ std::vector<SubExp> buildSubExpCandidates(
37793779
if (!canHelpPressureWhenSink(Exp, PassThrus, MRI, SIRI, MLI, DT,
37803780
IsCanClone, IsSgprBound)) {
37813781
if (AllowPartialUseInSubExp &&
3782-
Exp.isSafeToMove(MRI, /*IsMoveUp*/ false)) {
3782+
Exp.isSafeToMove(MRI)) {
37833783
SubExp FreeSubExp = buildFreeSubExp(Exp, PassThrus, MRI, SIRI);
37843784
if (canHelpPressureWhenSink(FreeSubExp, PassThrus, MRI, SIRI, MLI, DT,
37853785
IsCanClone, IsSgprBound)) {

0 commit comments

Comments
 (0)