summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
index 973491a70d3c..e109eed5f607 100644
--- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -16,6 +16,7 @@
#include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h"
+#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/Support/MathExtras.h"
@@ -389,8 +390,16 @@ void GCNScheduleDAGMILive::schedule() {
}
if (WavesAfter >= MinOccupancy) {
- Pressure[RegionIdx] = PressureAfter;
- return;
+ unsigned TotalVGPRs = AMDGPU::IsaInfo::getAddressableNumVGPRs(&ST);
+ unsigned TotalSGPRs = AMDGPU::IsaInfo::getAddressableNumSGPRs(&ST);
+ if (WavesAfter > MFI.getMinWavesPerEU() ||
+ PressureAfter.less(ST, PressureBefore) ||
+ (TotalVGPRs >= PressureAfter.getVGPRNum() &&
+ TotalSGPRs >= PressureAfter.getSGPRNum())) {
+ Pressure[RegionIdx] = PressureAfter;
+ return;
+ }
+ LLVM_DEBUG(dbgs() << "New pressure will result in more spilling.\n");
}
LLVM_DEBUG(dbgs() << "Attempting to revert scheduling.\n");