[llvm] [CodeGen] Add a pass for testing finalizeBundle (PR #149813)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 08:45:22 PDT 2025


================
@@ -359,3 +359,26 @@ PhysRegInfo llvm::AnalyzePhysRegInBundle(const MachineInstr &MI, Register Reg,
 
   return PRI;
 }
+
+namespace {
+class FinalizeBundleTest : public MachineFunctionPass {
+public:
+  static char ID;
+
+  FinalizeBundleTest() : MachineFunctionPass(ID) {
+    initializeFinalizeBundleTestPass(*PassRegistry::getPassRegistry());
+  }
+
+  bool runOnMachineFunction(MachineFunction &MF) override {
+    // For testing purposes, bundle the entire contents of each basic block
+    // except for terminators.
+    for (MachineBasicBlock &MBB : MF)
+      finalizeBundle(MBB, MBB.instr_begin(), MBB.getFirstInstrTerminator());
+    return true;
+  }
+};
+} // namespace
+
----------------
arsenm wrote:

Or if this is just for tests, it could exclusively be new pm 

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


More information about the llvm-commits mailing list