Skip to content

Commit c1b4e37

Browse files
committed
Simplifying scanning inside a bundle
1 parent f06e57f commit c1b4e37

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,15 +2502,18 @@ bool SchedGroup::canAddSU(SUnit &SU) const {
25022502
return canAddMI(MI);
25032503

25042504
// Special case for bundled MIs.
2505+
// Return true if all of the bundled MIs can be added to this group.
2506+
// A meta instruction in a bundle is an exception.
25052507
const MachineBasicBlock *MBB = MI.getParent();
2506-
MachineBasicBlock::instr_iterator B = MI.getIterator(), E = ++B;
2507-
while (E != MBB->end() && E->isBundledWithPred())
2508-
++E;
2508+
// Initially, iterator is on a bundler header.
2509+
MachineBasicBlock::instr_iterator B = std::next(MI.getIterator());
2510+
while (B != MBB->end() && B->isBundledWithPred()) {
2511+
if (!B->isMetaInstruction() && !canAddMI(*B))
2512+
return false;
2513+
++B;
2514+
}
25092515

2510-
// Return true if all of the bundled MIs can be added to this group.
2511-
return std::all_of(B, E, [this](MachineInstr &MI) {
2512-
return (MI.isMetaInstruction()) || canAddMI(MI);
2513-
});
2516+
return true;
25142517
}
25152518

25162519
void SchedGroup::initSchedGroup() {

0 commit comments

Comments
 (0)