llvm-project
c72cd16e - [ARM][MachineOutliner] Ignore debug instructions when checking LR in a block (#242649)

Commit
2 days ago
[ARM][MachineOutliner] Ignore debug instructions when checking LR in a block (#242649) `isMBBSafeToOutlineFrom` accumulates `LiveRegUnits` over every instruction in the block, including `DBG_VALUE`s. A `DBG_VALUE $lr` makes LR look used in the block, so the outliner treats LR as unavailable there and may not outline from it. Keeping `__builtin_return_address(0)` in a variable is enough to block outlining under `-g` (`thumbv7m`, `-Oz -moutline`). Iterate with `instructionsWithoutDebug` instead. The new MIR test runs the outliner on two functions with the same sequence in a block where LR is dead, one of them with a `DBG_VALUE $lr`. Without the change the sequence is not outlined; with it both functions call the outlined function. It is a new file because adding these functions to `machine-outliner-remove-debug-instr.mir` renumbers that test's outlined function. The `DBG_VALUE $lr` is written by hand: `-debugify-and-strip-all-safe` does not produce a debug value of LR in this block. This PR is assisted by Claude and reviewed by yqtian-se.
Author
Parents
Loading