Skip to content

Commit 83aab61

Browse files
committed
Remove redundant check
1 parent e09f596 commit 83aab61

File tree

3 files changed

+8
-29
lines changed

3 files changed

+8
-29
lines changed

llvm/lib/Target/AMDGPU/GCNRegPressure.cpp

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,13 @@ bool GCNRPTarget::isSaveBeneficial(Register Reg) const {
413413

414414
if (SRI->isSGPRClass(RC))
415415
return RP.getSGPRNum() > MaxSGPRs;
416-
if (SRI->isAGPRClass(RC))
417-
return isVGPRSaveBeneficial(RP.getAGPRNum(), RP.getArchVGPRNum());
418-
return isVGPRSaveBeneficial(RP.getArchVGPRNum(), RP.getAGPRNum());
416+
unsigned NumVGPRs =
417+
SRI->isAGPRClass(RC) ? RP.getAGPRNum() : RP.getArchVGPRNum();
418+
// The addressable limit must always be respected.
419+
if (NumVGPRs > MaxVGPRs)
420+
return true;
421+
// For unified RFs, combined VGPR usage limit must be respected as well.
422+
return UnifiedRF && RP.getVGPRNum(true) > MaxUnifiedVGPRs;
419423
}
420424

421425
bool GCNRPTarget::satisfied() const {
@@ -426,25 +430,6 @@ bool GCNRPTarget::satisfied() const {
426430
return true;
427431
}
428432

429-
bool GCNRPTarget::isVGPRSaveBeneficial(unsigned NumRegsInRC,
430-
unsigned NumRegsInOtherRC) const {
431-
// The addressable limit must always be respected.
432-
if (NumRegsInRC > MaxVGPRs)
433-
return true;
434-
if (UnifiedRF) {
435-
// Combined VGPR usage must be respected in unified RFs.
436-
if (RP.getVGPRNum(true) > MaxUnifiedVGPRs)
437-
return true;
438-
// When the other VGPR RC is above its addressable limit and there is not
439-
// enough space in this VGPR RC to fit all that excess through copies, we
440-
// consider savings in this VGPR RC beneficial as well.
441-
if (NumRegsInOtherRC > MaxVGPRs &&
442-
2 * MaxVGPRs < NumRegsInRC + NumRegsInOtherRC)
443-
return true;
444-
}
445-
return false;
446-
}
447-
448433
///////////////////////////////////////////////////////////////////////////////
449434
// GCNRPTracker
450435

llvm/lib/Target/AMDGPU/GCNRegPressure.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,6 @@ class GCNRPTarget {
252252
GCNRPTarget(const GCNRegPressure &RP, const MachineFunction &MF)
253253
: MF(MF), UnifiedRF(MF.getSubtarget<GCNSubtarget>().hasGFX90AInsts()),
254254
RP(RP) {}
255-
256-
/// Determines whether saving a VGPR from a VGPR RC (ArchVGPR or AGPR) where
257-
/// \p NumRegsInRC VGPRs are used is beneficial. \p NumRegsInOtherRC is the
258-
/// number of VGPRs in the other VGPR RC.
259-
bool isVGPRSaveBeneficial(unsigned NumRegsInRC,
260-
unsigned NumRegsInOtherRC) const;
261255
};
262256

263257
///////////////////////////////////////////////////////////////////////////////

llvm/test/CodeGen/AMDGPU/machine-scheduler-sink-trivial-remats-attr.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ body: |
753753
S_ENDPGM 0
754754
...
755755
# Min/Max waves/EU is 8. For targets with non-unified RF (gfx908) we are able to
756-
# eliminate both ArchVGPR and AGPR spilling by saving one of each. In the
756+
# eliminate both ArchVGPR and AGPR spilling by saving one of each. In the
757757
# unified RF case (gfx90a) the ArchVGPR allocation granule may force us to remat
758758
# more ArchVGPRs to eliminate spilling.
759759
---

0 commit comments

Comments
 (0)