[PATCH] D108585: [DebugInfo][InstrRef] Don't use instruction referencing for unoptimised functions

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 14:22:57 PDT 2021


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

InstrRefBasedLDV is marginally slower than VarlocBasedLDV when analysing optimised code -- however, it's much slower when analysing code compiled -O0. Up to 25% slower according to [0], which is too much!

To avoid this: don't use instruction referencing for -O0 functions. In the "pure" case of unoptimised code, this won't really harm the debugging experience because most variables won't have been promoted off the stack, so can't go missing. It becomes more complicated when optimised code is inlined into functions marked optnone; however these are rare, and as -O0 doesn't run many optimisations there should be little damage to the debug experience as a result.

I've taken the opportunity to refactor testing for instruction-referencing into a MachineFunction method, which seems the most appropriate place to put it.

[0] http://llvm-compile-time-tracker.com/compare.php?from=ee8da6369225f47f85e61e1ef2807af6a8677a0d&to=3313f75407bf1f1f4dd787e5233d99cc9e42ba55&stat=instructions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108585

Files:
  llvm/include/llvm/CodeGen/MachineFunction.h
  llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
  llvm/lib/CodeGen/LiveDebugVariables.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/test/DebugInfo/X86/instr-ref-opt-levels.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108585.368210.patch
Type: text/x-patch
Size: 5139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210823/bc5ebc8d/attachment-0001.bin>


More information about the llvm-commits mailing list