|
27 | 27 | #include "AMDGPUIGroupLP.h" |
28 | 28 | #include "SIMachineFunctionInfo.h" |
29 | 29 | #include "llvm/CodeGen/RegisterClassInfo.h" |
30 | | -#include "llvm/CodeGen/ScheduleDAGInstrs.h" |
31 | 30 |
|
32 | 31 | #define DEBUG_TYPE "machine-scheduler" |
33 | 32 |
|
@@ -189,6 +188,12 @@ static void getRegisterPressures( |
189 | 188 | Pressure[AMDGPU::RegisterPressureSets::AGPR_32] = NewPressure.getAGPRNum(); |
190 | 189 | } |
191 | 190 |
|
| 191 | +// Return true if the instruction is mutually exclusive with all non-IGLP DAG |
| 192 | +// mutations, requiring all other mutations to be disabled. |
| 193 | +static bool isIGLPMutationOnly(unsigned Opcode) { |
| 194 | + return Opcode == AMDGPU::SCHED_GROUP_BARRIER || Opcode == AMDGPU::IGLP_OPT; |
| 195 | +} |
| 196 | + |
192 | 197 | void GCNSchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU, |
193 | 198 | bool AtTop, |
194 | 199 | const RegPressureTracker &RPTracker, |
@@ -1153,8 +1158,7 @@ bool GCNSchedStage::initGCNRegion() { |
1153 | 1158 | StageID == GCNSchedStageID::ILPInitialSchedule) { |
1154 | 1159 | for (auto &I : DAG) { |
1155 | 1160 | Unsched.push_back(&I); |
1156 | | - if (I.getOpcode() == AMDGPU::SCHED_GROUP_BARRIER || |
1157 | | - I.getOpcode() == AMDGPU::IGLP_OPT) |
| 1161 | + if (isIGLPMutationOnly(I.getOpcode())) |
1158 | 1162 | DAG.RegionsWithIGLPInstrs[RegionIdx] = true; |
1159 | 1163 | } |
1160 | 1164 | } else { |
@@ -1893,43 +1897,17 @@ void GCNScheduleDAGMILive::updateRegionBoundaries( |
1893 | 1897 | } |
1894 | 1898 | } |
1895 | 1899 |
|
1896 | | -static bool isIGLPInstr(MachineInstr *MI) { |
1897 | | - switch (MI->getOpcode()) { |
1898 | | - case AMDGPU::IGLP_OPT: |
1899 | | - case AMDGPU::SCHED_BARRIER: |
1900 | | - case AMDGPU::SCHED_GROUP_BARRIER: |
1901 | | - return true; |
1902 | | - default: |
1903 | | - return false; |
1904 | | - } |
1905 | | -} |
1906 | | - |
1907 | 1900 | static bool hasIGLPInstrs(ScheduleDAGInstrs *DAG) { |
1908 | 1901 | return any_of(*DAG, [](MachineBasicBlock::iterator MI) { |
1909 | | - unsigned Opc = MI->getOpcode(); |
1910 | | - return Opc == AMDGPU::SCHED_GROUP_BARRIER || Opc == AMDGPU::IGLP_OPT; |
| 1902 | + return isIGLPMutationOnly(MI->getOpcode()); |
1911 | 1903 | }); |
1912 | 1904 | } |
1913 | 1905 |
|
1914 | | -bool GCNScheduleDAGMILive::isGlobalMemoryObject(MachineInstr *MI) { |
1915 | | - if (isIGLPInstr(MI)) |
1916 | | - return false; |
1917 | | - |
1918 | | - return ScheduleDAGInstrs::isGlobalMemoryObject(MI); |
1919 | | -} |
1920 | | - |
1921 | 1906 | GCNPostScheduleDAGMILive::GCNPostScheduleDAGMILive( |
1922 | 1907 | MachineSchedContext *C, std::unique_ptr<MachineSchedStrategy> S, |
1923 | 1908 | bool RemoveKillFlags) |
1924 | 1909 | : ScheduleDAGMI(C, std::move(S), RemoveKillFlags) {} |
1925 | 1910 |
|
1926 | | -bool GCNPostScheduleDAGMILive::isGlobalMemoryObject(MachineInstr *MI) { |
1927 | | - if (isIGLPInstr(MI)) |
1928 | | - return false; |
1929 | | - |
1930 | | - return ScheduleDAGInstrs::isGlobalMemoryObject(MI); |
1931 | | -} |
1932 | | - |
1933 | 1911 | void GCNPostScheduleDAGMILive::schedule() { |
1934 | 1912 | HasIGLPInstrs = hasIGLPInstrs(this); |
1935 | 1913 | if (HasIGLPInstrs) { |
|
0 commit comments