Skip to content

Commit c1e829f

Browse files
authored
[AMDGPU] Simplify waitcnt insertion on function entry. NFC. (llvm#172461)
This pass runs way too late for PHI instructions.
1 parent c3ebcfe commit c1e829f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,7 +2829,6 @@ bool SIInsertWaitcnts::run(MachineFunction &MF) {
28292829
bool Modified = false;
28302830

28312831
MachineBasicBlock &EntryBB = MF.front();
2832-
MachineBasicBlock::iterator I = EntryBB.begin();
28332832

28342833
if (!MFI->isEntryFunction()) {
28352834
// Wait for any outstanding memory operations that the input registers may
@@ -2838,9 +2837,9 @@ bool SIInsertWaitcnts::run(MachineFunction &MF) {
28382837

28392838
// TODO: Could insert earlier and schedule more liberally with operations
28402839
// that only use caller preserved registers.
2841-
for (MachineBasicBlock::iterator E = EntryBB.end();
2842-
I != E && (I->isPHI() || I->isMetaInstruction()); ++I)
2843-
;
2840+
MachineBasicBlock::iterator I = EntryBB.begin();
2841+
while (I != EntryBB.end() && I->isMetaInstruction())
2842+
++I;
28442843

28452844
if (ST->hasExtendedWaitCounts()) {
28462845
BuildMI(EntryBB, I, DebugLoc(), TII->get(AMDGPU::S_WAIT_LOADCNT_DSCNT))

0 commit comments

Comments
 (0)