[llvm] [ModuloSchedule] Implement modulo variable expansion for pipelining (PR #65609)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 09:53:53 PDT 2024


================
@@ -9631,48 +9888,76 @@ AArch64InstrInfo::analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const {
     return nullptr;
 
   // Must be conditional branch
-  if (FBB == nullptr)
+  if (TBB != LoopBB && FBB == nullptr)
     return nullptr;
 
   assert((TBB == LoopBB || FBB == LoopBB) &&
          "The Loop must be a single-basic-block loop");
 
+  MachineInstr *CondBranch = &*LoopBB->getFirstTerminator();
+  const TargetRegisterInfo &TRI = getRegisterInfo();
+
+  if (CondBranch->getOpcode() != AArch64::Bcc)
+    return nullptr;
+
   // Normalization for createTripCountGreaterCondition()
   if (TBB == LoopBB)
     reverseBranchCondition(Cond);
 
-  MachineInstr *CondBranch = &*LoopBB->getFirstTerminator();
-  const TargetRegisterInfo &TRI = getRegisterInfo();
-
-  // Find the immediate predecessor of the conditional branch
-  MachineInstr *PredBranch = nullptr;
-  if (CondBranch->getOpcode() == AArch64::Bcc) {
-    for (MachineInstr &MI : reverse(*LoopBB)) {
-      if (MI.modifiesRegister(AArch64::NZCV, &TRI)) {
-        PredBranch = &MI;
+  MachineInstr *Comp = nullptr;
+  unsigned CompCounterOprNum = 0;
+  for (MachineInstr &MI : reverse(*LoopBB)) {
+    if (MI.modifiesRegister(AArch64::NZCV, &TRI)) {
----------------
davemgreen wrote:

Thanks.

https://github.com/llvm/llvm-project/pull/65609


More information about the llvm-commits mailing list