diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp --- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp +++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp @@ -79,10 +79,12 @@ const SIRegisterInfo *SRI, unsigned SGPRPressure, unsigned VGPRPressure) { - Cand.SU = SU; Cand.AtTop = AtTop; + if (!DAG->isTrackingPressure()) + return; + // getDownwardPressure() and getUpwardPressure() make temporary changes to // the tracker, so we need to pass those function a non-const copy. RegPressureTracker &TempTracker = const_cast(RPTracker); @@ -165,8 +167,12 @@ SchedCandidate &Cand) { const SIRegisterInfo *SRI = static_cast(TRI); ArrayRef Pressure = RPTracker.getRegSetPressureAtPos(); - unsigned SGPRPressure = Pressure[AMDGPU::RegisterPressureSets::SReg_32]; - unsigned VGPRPressure = Pressure[AMDGPU::RegisterPressureSets::VGPR_32]; + unsigned SGPRPressure = 0; + unsigned VGPRPressure = 0; + if (DAG->isTrackingPressure()) { + SGPRPressure = Pressure[AMDGPU::RegisterPressureSets::SReg_32]; + VGPRPressure = Pressure[AMDGPU::RegisterPressureSets::VGPR_32]; + } ReadyQueue &Q = Zone.Available; for (SUnit *SU : Q) { diff --git a/llvm/test/CodeGen/AMDGPU/schedule-regpressure.mir b/llvm/test/CodeGen/AMDGPU/schedule-regpressure.mir --- a/llvm/test/CodeGen/AMDGPU/schedule-regpressure.mir +++ b/llvm/test/CodeGen/AMDGPU/schedule-regpressure.mir @@ -1,4 +1,6 @@ # RUN: llc -march=amdgcn -misched=converge -run-pass machine-scheduler %s -o - -debug-only=machine-scheduler 2>&1 | FileCheck %s +# RUN: llc -march=amdgcn -misched-regpressure=false -run-pass machine-scheduler %s -o - -debug-only=machine-scheduler 2>&1 | FileCheck %s --check-prefix=NORP + # REQUIRES: asserts # Check there is no SReg_32 pressure created by DS_* instructions because of M0 use @@ -8,6 +10,19 @@ # CHECK: Pressure Diff : {{$}} # CHECK: SU({{.*}} DS_WRITE_B32 +# NORP: ScheduleDAGMILive::schedule starting +# NORP: GenericScheduler RegionPolicy: ShouldTrackPressure=0 +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Pressure Diff : {{$}} +# NORP-NOT: Bottom Pressure: +# NORP-NOT: UpdateRegP +# NORP-NOT: UpdateRegP +# NORP-NOT: UpdateRegP + --- name: mo_pset alignment: 1