aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstrBundle.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2025-07-23 11:35:57 +0100
committerGitHub <noreply@github.com>2025-07-23 11:35:57 +0100
commit756ac65987b84b7427c25d76f069a04a4a817a5c (patch)
tree7c3d20b61e8fcdafeff8123054e215d7ad70b5ab /llvm/lib/CodeGen/MachineInstrBundle.cpp
parent33455825428f9e1b7998a66e228da7f6d483acf8 (diff)
downloadllvm-756ac65987b84b7427c25d76f069a04a4a817a5c.zip
llvm-756ac65987b84b7427c25d76f069a04a4a817a5c.tar.gz
llvm-756ac65987b84b7427c25d76f069a04a4a817a5c.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstrBundle.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstrBundle.cpp10
1 files changed, 10 insertions, 0 deletions
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();
+}