From e18dbeb24f4c5627d3afd6e8a2a99eaee8607017 Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Wed, 7 Mar 2018 08:45:09 +0000 Subject: [PATCH] [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 llvm-svn: 326879 --- llvm/lib/Target/SystemZ/SystemZHazardRecognizer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZHazardRecognizer.cpp b/llvm/lib/Target/SystemZ/SystemZHazardRecognizer.cpp index d29711e..d71d1fd 100644 --- a/llvm/lib/Target/SystemZ/SystemZHazardRecognizer.cpp +++ b/llvm/lib/Target/SystemZ/SystemZHazardRecognizer.cpp @@ -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::emitInstruction(MachineInstr *MI, } } + 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(); -- 2.7.4