Skip to content

Commit f0ec9f1

Browse files
committed
[Pipeliner] Fixed optimization remarks and debug dumps Initiation
Interval value The II value was incremented before exiting the loop, and therefor when used in the optimization remarks and debug dumps it did not reflect the initiation interval actually used in Schedule. Differential Revision: https://reviews.llvm.org/D95692
1 parent 40862b1 commit f0ec9f1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

llvm/include/llvm/CodeGen/MachinePipeliner.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@ class SMSchedule {
526526
/// Set the initiation interval for this schedule.
527527
void setInitiationInterval(int ii) { InitiationInterval = ii; }
528528

529+
/// Return the initiation interval for this schedule.
530+
int getInitiationInterval() const { return InitiationInterval; }
531+
529532
/// Return the first cycle in the completed schedule. This
530533
/// can be a negative value.
531534
int getFirstCycle() const { return FirstCycle; }

llvm/lib/CodeGen/MachinePipeliner.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,9 +2034,8 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
20342034
}
20352035

20362036
bool scheduleFound = false;
2037-
unsigned II = 0;
20382037
// Keep increasing II until a valid schedule is found.
2039-
for (II = MII; II <= MAX_II && !scheduleFound; ++II) {
2038+
for (unsigned II = MII; II <= MAX_II && !scheduleFound; ++II) {
20402039
Schedule.reset();
20412040
Schedule.setInitiationInterval(II);
20422041
LLVM_DEBUG(dbgs() << "Try to schedule with " << II << "\n");
@@ -2109,15 +2108,17 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
21092108
scheduleFound = Schedule.isValidSchedule(this);
21102109
}
21112110

2112-
LLVM_DEBUG(dbgs() << "Schedule Found? " << scheduleFound << " (II=" << II
2111+
LLVM_DEBUG(dbgs() << "Schedule Found? " << scheduleFound
2112+
<< " (II=" << Schedule.getInitiationInterval()
21132113
<< ")\n");
21142114

21152115
if (scheduleFound) {
21162116
Schedule.finalizeSchedule(this);
21172117
Pass.ORE->emit([&]() {
21182118
return MachineOptimizationRemarkAnalysis(
21192119
DEBUG_TYPE, "schedule", Loop.getStartLoc(), Loop.getHeader())
2120-
<< "Schedule found with Initiation Interval: " << ore::NV("II", II)
2120+
<< "Schedule found with Initiation Interval: "
2121+
<< ore::NV("II", Schedule.getInitiationInterval())
21212122
<< ", MaxStageCount: "
21222123
<< ore::NV("MaxStageCount", Schedule.getMaxStageCount());
21232124
});

0 commit comments

Comments
 (0)