From 756ac65987b84b7427c25d76f069a04a4a817a5c Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 23 Jul 2025 11:35:57 +0100 Subject: [CodeGen] Add a pass for testing finalizeBundle (#149813) This allows for unit testing of finalizeBundle with standard MIR tests using update_mir_test_checks.py. --- llvm/lib/CodeGen/MachineInstrBundle.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/CodeGen/MachineInstrBundle.cpp') diff --git a/llvm/lib/CodeGen/MachineInstrBundle.cpp b/llvm/lib/CodeGen/MachineInstrBundle.cpp index 34896c6..44b648a 100644 --- a/llvm/lib/CodeGen/MachineInstrBundle.cpp +++ b/llvm/lib/CodeGen/MachineInstrBundle.cpp @@ -359,3 +359,13 @@ PhysRegInfo llvm::AnalyzePhysRegInBundle(const MachineInstr &MI, Register Reg, return PRI; } + +PreservedAnalyses +llvm::FinalizeBundleTestPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &) { + // 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 PreservedAnalyses::none(); +} -- cgit v1.1