[llvm] [FinalizelSel] Re-scan the MachineFunction if we insert a new MBB by custom insertion (PR #96046)

Jianjian Guan via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 23:21:51 PDT 2024


================
@@ -66,13 +67,19 @@ static std::pair<bool, bool> runImpl(MachineFunction &MF) {
         // The expansion may involve new basic blocks.
         if (NewMBB != MBB) {
           PreserveCFG = false;
-          MBB = NewMBB;
-          I = NewMBB->getIterator();
-          MBBI = NewMBB->begin();
-          MBBE = NewMBB->end();
+          InsertNewMBB = true;
+          break;
         }
       }
     }
+
+    ++I;
+
+    // If we insert a new MBB, we should re-scan to avoid missing some MI.
+    if (InsertNewMBB) {
+      I = MF.begin();
+      InsertNewMBB = false;
+    }
----------------
jacquesguan wrote:

I change to continue scan current MBB.

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


More information about the llvm-commits mailing list