[all-commits] [llvm/llvm-project] bf483d: [DWARF] Emit a worst-case prologue_end flag for pa...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Tue Nov 12 07:10:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf483ddb42065405e345393e022dc72357ec5a3a
      https://github.com/llvm/llvm-project/commit/bf483ddb42065405e345393e022dc72357ec5a3a
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2024-11-12 (Tue, 12 Nov 2024)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/test/CodeGen/X86/no-non-zero-debug-loc-prologue.ll
    M llvm/test/CodeGen/X86/pseudo_cmov_lower2.ll
    A llvm/test/DebugInfo/MIR/X86/dbg-prologue-backup-loc2.mir
    M llvm/test/DebugInfo/MIR/X86/empty-inline.mir
    A llvm/test/DebugInfo/X86/dbg-prolog-end-backup-loc.ll
    M llvm/test/DebugInfo/X86/dbg-prolog-end.ll
    M llvm/test/DebugInfo/X86/empty-line-info.ll
    M llvm/test/DebugInfo/X86/loop-align-debug.ll

  Log Message:
  -----------
  [DWARF] Emit a worst-case prologue_end flag for pathological inputs (#107849)

prologue_end usually indicates where the end of the function-initialization
lies, and is where debuggers usually choose to put the initial breakpoint
for a function. Our current algorithm piggy-backs it on the first available
source-location: which doesn't necessarily have anything to do with the
start of the function.

To avoid this in heavily-optimised code that lacks many useful source
locations, pick a worst-case "if all else fails" prologue_end location, of
the first instruction that appears to do meaningful computation. It'll be
given the function-scope line number, which should run-on from the start of
the function anyway. This means if your code is completely inverted by the
optimiser, you can at least put a breakpoint at the _start_ like you
expect, even if it's difficult to then step through.

This patch also attempts to preserve some good behaviour we have without
optimisations -- at O0, if the prologue immediately falls into a loop body
without any computation happening, then prologue_end lands at the start of
that loop. This is desirable; but does mean we need to do more work to
detect and support those situations.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list