Skip to content

Commit e43ffd1

Browse files
author
Snehasish Kumar
committed
Update docs to mention SamplePGO debug info usage.
1 parent df04e25 commit e43ffd1

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

llvm/docs/HowToUpdateDebugInfo.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Introduction
99
============
1010

1111
Certain kinds of code transformations can inadvertently result in a loss of
12-
debug info, or worse, make debug info misrepresent the state of a program.
12+
debug info, or worse, make debug info misrepresent the state of a program. Debug
13+
info availability is also essential for SamplePGO.
1314

1415
This document specifies how to correctly update debug info in various kinds of
1516
code transformations, and offers suggestions for how to create targeted debug
@@ -89,9 +90,14 @@ has a location with an accurate scope attached, and b) to prevent misleading
8990
single-stepping (or breakpoint) behavior. Often, merged instructions are memory
9091
accesses which can trap: having an accurate scope attached greatly assists in
9192
crash triage by identifying the (possibly inlined) function where the bad
92-
memory access occurred. This rule is also meant to assist SamplePGO by banning
93-
scenarios in which a sample of a block containing a merged instruction is
94-
misattributed to a block containing one of the instructions-to-be-merged.
93+
memory access occurred.
94+
95+
For SamplePGO, it is often beneficial to retain an arbitrary but deterministic
96+
location instead of discarding line and column information as part of merging.
97+
In particular, loss of location information for calls inhibit optimizations
98+
such as indirect call promotion. This behavior can be optionally enabled until
99+
support for accurately representing merged instructions in the line table is
100+
implemented.
95101

96102
Examples of transformations that should follow this rule include:
97103

llvm/docs/SourceLevelDebugging.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ the stored debug information into source-language specific information. As
5555
such, a debugger must be aware of the source-language, and is thus tied to a
5656
specific language or family of languages.
5757

58+
.. _intro_consumers:
59+
5860
Debug information consumers
5961
---------------------------
6062

@@ -71,6 +73,12 @@ as Visual Studio and WinDBG. LLVM's debug information format is mostly derived
7173
from and inspired by DWARF, but it is feasible to translate into other target
7274
debug info formats such as STABS.
7375

76+
SamplePGO (also known as `AutoFDO <https://gcc.gnu.org/wiki/AutoFDO>`_)
77+
is a variant of profile guided optimizations which uses hardware sampling based
78+
profilers to collect branch frequency data to with low overhead in production
79+
environments. It relies on debug information to associate profile information
80+
to LLVM IR which is then used to guide optimization heuristics.
81+
7482
It would also be reasonable to use debug information to feed profiling tools
7583
for analysis of generated code, or, tools for reconstructing the original
7684
source from generated code.

0 commit comments

Comments
 (0)