[llvm] r328000 - [Hexagon] Correct the computation of TopReadyCycle and BotReadyCycle of SU

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 10:03:27 PDT 2018


Author: kparzysz
Date: Tue Mar 20 10:03:27 2018
New Revision: 328000

URL: http://llvm.org/viewvc/llvm-project?rev=328000&view=rev
Log:
[Hexagon] Correct the computation of TopReadyCycle and BotReadyCycle of SU

TopReadyCycle and BotReadyCycle were off by one cycle when an SU is either
the first instruction or the last instruction in a packet.

Patch by Ikhlas Ajbar.

Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp
    llvm/trunk/test/CodeGen/Hexagon/swp-stages4.ll

Modified: llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp?rev=328000&r1=327999&r2=328000&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonMachineScheduler.cpp Tue Mar 20 10:03:27 2018
@@ -153,9 +153,10 @@ bool VLIWResourceModel::reserveResources
     TotalPackets++;
     return false;
   }
-  // If this SU does not fit in the packet
+  // If this SU does not fit in the packet or the packet is now full
   // start a new one.
-  if (!isResourceAvailable(SU, IsTop)) {
+  if (!isResourceAvailable(SU, IsTop) ||
+      Packet.size() >= SchedModel->getIssueWidth()) {
     ResourcesModel->clearResources();
     Packet.clear();
     TotalPackets++;
@@ -189,15 +190,6 @@ bool VLIWResourceModel::reserveResources
   }
 #endif
 
-  // If packet is now full, reset the state so in the next cycle
-  // we start fresh.
-  if (Packet.size() >= SchedModel->getIssueWidth()) {
-    ResourcesModel->clearResources();
-    Packet.clear();
-    TotalPackets++;
-    startNewCycle = true;
-  }
-
   return startNewCycle;
 }
 
@@ -1100,10 +1092,10 @@ SUnit *ConvergingVLIWScheduler::pickNode
 /// does.
 void ConvergingVLIWScheduler::schedNode(SUnit *SU, bool IsTopNode) {
   if (IsTopNode) {
-    SU->TopReadyCycle = Top.CurrCycle;
     Top.bumpNode(SU);
+    SU->TopReadyCycle = Top.CurrCycle;
   } else {
-    SU->BotReadyCycle = Bot.CurrCycle;
     Bot.bumpNode(SU);
+    SU->BotReadyCycle = Bot.CurrCycle;
   }
 }

Modified: llvm/trunk/test/CodeGen/Hexagon/swp-stages4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/swp-stages4.ll?rev=328000&r1=327999&r2=328000&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/swp-stages4.ll (original)
+++ llvm/trunk/test/CodeGen/Hexagon/swp-stages4.ll Tue Mar 20 10:03:27 2018
@@ -12,7 +12,6 @@
 ; CHECK: .LBB0_[[LOOP]]:
 ; CHECK: = add(r{{[0-9]+}},r[[REG0]])
 ; CHECK: = and
-; CHECK: = and
 ; CHECK: r[[REG0]] = and
 ; CHECK: endloop
 




More information about the llvm-commits mailing list