[llvm] r326879 - [SystemZ] NFC refactoring in SystemZHazardRecognizer.

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 00:45:10 PST 2018


Author: jonpa
Date: Wed Mar  7 00:45:09 2018
New Revision: 326879

URL: http://llvm.org/viewvc/llvm-project?rev=326879&view=rev
Log:
[SystemZ] NFC refactoring in SystemZHazardRecognizer.

Handle the not-taken branch in emitInstruction() where the TakenBranch
argument is available. This is cleaner than relying on EmitInstruction().

Review: Ulrich Weigand

Modified:
    llvm/trunk/lib/Target/SystemZ/SystemZHazardRecognizer.cpp

Modified: llvm/trunk/lib/Target/SystemZ/SystemZHazardRecognizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZHazardRecognizer.cpp?rev=326879&r1=326878&r2=326879&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZHazardRecognizer.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZHazardRecognizer.cpp Wed Mar  7 00:45:09 2018
@@ -283,9 +283,6 @@ EmitInstruction(SUnit *SU) {
           << LastFPdOpCycleIdx << "\n";);
   }
 
-  bool GroupEndingBranch =
-    (CurrGroupSize >= 1 && isBranchRetTrap(SU->getInstr()));
-
   // Insert SU into current group by increasing number of slots used
   // in current group.
   CurrGroupSize += getNumDecoderSlots(SU);
@@ -293,7 +290,7 @@ EmitInstruction(SUnit *SU) {
 
   // Check if current group is now full/ended. If so, move on to next
   // group to be ready to evaluate more candidates.
-  if (CurrGroupSize == 3 || SC->EndGroup || GroupEndingBranch)
+  if (CurrGroupSize == 3 || SC->EndGroup)
     nextGroup();
 }
 
@@ -386,8 +383,15 @@ void SystemZHazardRecognizer::emitInstru
     }
   }
 
+  unsigned GroupSizeBeforeEmit = CurrGroupSize;
   EmitInstruction(&SU);
 
+  if (!TakenBranch && isBranchRetTrap(MI)) {
+    // NT Branch on second slot ends group.
+    if (GroupSizeBeforeEmit == 1)
+      nextGroup();
+  }
+
   if (TakenBranch && CurrGroupSize > 0)
     nextGroup();
 




More information about the llvm-commits mailing list