[llvm] [BranchFolder] Prevent nested salvage in empty BB chains with pseudo probes (PR #206092)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 06:05:09 PDT 2026


================
@@ -1283,6 +1283,11 @@ static bool IsBranchOnlyBlock(MachineBasicBlock *MBB) {
   return I->isBranch();
 }
 
+static bool HasPseudoProbe(const MachineBasicBlock &MBB) {
----------------
Jinjie-Huang wrote:

Since HasPseudoProbe is only invoked when the MBB is already confirmed to be "empty", the block size is generally quite small (unless we hit the exact pathological case of massively accumulated DBGs that this PR is trying to fix).

However, if an extra linear traversal here is still a performance concern, I can fold this pseudo-probe check into IsEmptyBlock() to piggyback on its existing linear scan. Let me know if you'd prefer that approach!

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


More information about the llvm-commits mailing list