[llvm] [MachineOutliner] Properly handle Debug MachineInstrs (PR #219326)
David Tellenbach via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 5 21:18:05 PDT 2026
================
@@ -1290,11 +1294,22 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M) {
LLVM_DEBUG(dbgs() << " MAPPING MBB: '" << MBB.getName() << "'\n");
// If there isn't anything in MBB, then there's no point in outlining from
// it.
- // If there are fewer than 2 instructions in the MBB, then it can't ever
- // contain something worth outlining.
+ // If there are fewer than 2 non-debug instructions in the MBB, then it
+ // can't ever contain something worth outlining. Count raw instructions,
+ // including bundle interiors, to preserve MBB.size() behavior. Pseudo
+ // probes also retain their historical treatment as ordinary
+ // instructions.
// FIXME: This should be based off of the maximum size in B of an outlined
// call versus the size in B of the MBB.
- if (MBB.size() < MinMBBSize) {
+ unsigned NumNonDebugInstrs = 0;
+ for (const MachineInstr &MI : MBB.instrs()) {
----------------
dtellenbach wrote:
You can just use `instructionsWithoutDebug(MBB.instr_begin(), MBB.instr_end(), /* SkipPseudoprobe */ false)`.
https://github.com/llvm/llvm-project/pull/219326
More information about the llvm-commits
mailing list