diff options
author | Jay Foad <jay.foad@amd.com> | 2025-07-23 11:35:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-23 11:35:57 +0100 |
commit | 756ac65987b84b7427c25d76f069a04a4a817a5c (patch) | |
tree | 7c3d20b61e8fcdafeff8123054e215d7ad70b5ab /llvm/lib | |
parent | 33455825428f9e1b7998a66e228da7f6d483acf8 (diff) | |
download | llvm-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')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstrBundle.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 1 |
2 files changed, 11 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(); +} diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index e15570c..cff7ab5 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -124,6 +124,7 @@ #include "llvm/CodeGen/MachineCopyPropagation.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h" +#include "llvm/CodeGen/MachineInstrBundle.h" #include "llvm/CodeGen/MachineLICM.h" #include "llvm/CodeGen/MachineLateInstrsCleanup.h" #include "llvm/CodeGen/MachinePassManager.h" |