[llvm] f0ec9f1 - [Pipeliner] Fixed optimization remarks and debug dumps Initiation

Marianne Mailhot-Sarrasin via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 09:30:06 PST 2021


Author: Marianne Mailhot-Sarrasin
Date: 2021-02-17T12:28:37-05:00
New Revision: f0ec9f1bb3f2236afaddc68bd6cb6f1e74c2a402

URL: https://github.com/llvm/llvm-project/commit/f0ec9f1bb3f2236afaddc68bd6cb6f1e74c2a402
DIFF: https://github.com/llvm/llvm-project/commit/f0ec9f1bb3f2236afaddc68bd6cb6f1e74c2a402.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachinePipeliner.h
    llvm/lib/CodeGen/MachinePipeliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h b/llvm/include/llvm/CodeGen/MachinePipeliner.h
index ad7d109068dc..7e7fa57d80da 100644
--- a/llvm/include/llvm/CodeGen/MachinePipeliner.h
+++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h
@@ -526,6 +526,9 @@ class SMSchedule {
   /// Set the initiation interval for this schedule.
   void setInitiationInterval(int ii) { InitiationInterval = ii; }
 
+  /// Return the initiation interval for this schedule.
+  int getInitiationInterval() const { return InitiationInterval; }
+
   /// Return the first cycle in the completed schedule.  This
   /// can be a negative value.
   int getFirstCycle() const { return FirstCycle; }

diff  --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index e09e5fd78594..7e5fa221b775 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2034,9 +2034,8 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
   }
 
   bool scheduleFound = false;
-  unsigned II = 0;
   // Keep increasing II until a valid schedule is found.
-  for (II = MII; II <= MAX_II && !scheduleFound; ++II) {
+  for (unsigned II = MII; II <= MAX_II && !scheduleFound; ++II) {
     Schedule.reset();
     Schedule.setInitiationInterval(II);
     LLVM_DEBUG(dbgs() << "Try to schedule with " << II << "\n");
@@ -2109,7 +2108,8 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
       scheduleFound = Schedule.isValidSchedule(this);
   }
 
-  LLVM_DEBUG(dbgs() << "Schedule Found? " << scheduleFound << " (II=" << II
+  LLVM_DEBUG(dbgs() << "Schedule Found? " << scheduleFound
+                    << " (II=" << Schedule.getInitiationInterval()
                     << ")\n");
 
   if (scheduleFound) {
@@ -2117,7 +2117,8 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
     Pass.ORE->emit([&]() {
       return MachineOptimizationRemarkAnalysis(
                  DEBUG_TYPE, "schedule", Loop.getStartLoc(), Loop.getHeader())
-             << "Schedule found with Initiation Interval: " << ore::NV("II", II)
+             << "Schedule found with Initiation Interval: "
+             << ore::NV("II", Schedule.getInitiationInterval())
              << ", MaxStageCount: "
              << ore::NV("MaxStageCount", Schedule.getMaxStageCount());
     });


        


More information about the llvm-commits mailing list