[PATCH] D114452: [DebugInfo][InstrRef][X86] Instrument expanded DYN_ALLOCA_ instructions with instruction numbers

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 09:21:37 PST 2021


jmorse created this revision.
jmorse added reviewers: StephenTozer, Orlando, TWeaver, djtodoro, craig.topper.
Herald added subscribers: pengfei, hiraditya.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

If we have a DYN_ALLOCA_* instruction, it will eventually be expanded to a stack probe and subtract-from-SP. Add debug-info instrumentation to `X86FrameLowering::emitStackProbe` so that it can redirect debug-info for the DYN_ALLOCA to the lowered stack probe.

In practice, this means putting an instruction number label either the call instruction to `_chkstk` for win32, or more commonly on the subtract from SP instruction. The two tests added cover both of these cases.

NB:

- I don't think there are any paths with the Large code-model and 64-bit Windows that will use the NumCallOps number, because it's only win32 that uses `_chkstck` to modify SP,
- There are other code paths from `emitStackProbe` that implement probes, such as `emitStackProbeInline`, but I believe they all deal with fixed-size allocations in the prologue, and so aren't of interest to lowered DYN_ALLOCA instructions

(Adding Craig as this touches X86 things)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114452

Files:
  llvm/lib/Target/X86/X86DynAllocaExpander.cpp
  llvm/lib/Target/X86/X86FrameLowering.cpp
  llvm/lib/Target/X86/X86FrameLowering.h
  llvm/test/DebugInfo/X86/instr-ref-dyn-alloca-win32.ll
  llvm/test/DebugInfo/X86/instr-ref-dyn-alloca.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114452.389215.patch
Type: text/x-patch
Size: 20780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/c8c9f64c/attachment.bin>


More information about the llvm-commits mailing list