llvm-project
578452f4 - [X86] Skip debug instructions when adjusting the stack with pops (#229392)

Commit
5 days ago
[X86] Skip debug instructions when adjusting the stack with pops (#229392) At `minsize`, X86 can discard one or two stack slots after a call using one-byte `popl` instructions instead of a larger `addl` instruction. Adding debug information could prevent this optimization and change the ordinary generated code. `eliminateCallFramePseudoInstr()` removes the call-frame adjustment pseudo and advances the cleanup insertion point past debug instructions. `adjustStackWithPops()` then used `std::prev()` to inspect the preceding instruction. If a `DBG_VALUE` appeared between the call and the insertion point, it saw the debug instruction instead of the call and rejected the pop-based cleanup. Use `prev_nodbg()` to find the preceding call while preserving the existing pseudo-probe behavior. The regression test places a debug value after a call and verifies that the two-slot cleanup still uses two `popl` instructions rather than `addl $8, %esp`. The regression check fails before this change and passes afterward. The complete X86 CodeGen test suite also passes.
Author
Parents
Loading