Skip to content

Commit 713ae85

Browse files
author
Snehasish Kumar
committed
Enhance the documentation for SamplePGO.
1 parent ffea531 commit 713ae85

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

llvm/docs/HowToUpdateDebugInfo.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ has a location with an accurate scope attached, and b) to prevent misleading
9090
single-stepping (or breakpoint) behavior. Often, merged instructions are memory
9191
accesses which can trap: having an accurate scope attached greatly assists in
9292
crash triage by identifying the (possibly inlined) function where the bad
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.
93+
memory access occurred.
94+
95+
To maintain distinct source locations for SamplePGO, it is often beneficial to
96+
retain an arbitrary but deterministic location instead of discarding line and
97+
column information as part of merging. In particular, loss of location
98+
information for calls inhibit optimizations such as indirect call promotion.
99+
This behavior can be optionally enabled until support for accurately
100+
representing merged instructions in the line table is implemented.
101101

102102
Examples of transformations that should follow this rule include:
103103

llvm/docs/SourceLevelDebugging.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ SamplePGO (also known as `AutoFDO <https://gcc.gnu.org/wiki/AutoFDO>`_)
7777
is a variant of profile guided optimizations which uses hardware sampling based
7878
profilers to collect branch frequency data with low overhead in production
7979
environments. It relies on debug information to associate profile information
80-
to LLVM IR which is then used to guide optimization heuristics.
80+
to LLVM IR which is then used to guide optimization heuristics. Maintaining
81+
deterministic and distinct source locations is necessary to maximize the
82+
accuracy of mapping hardware sample counts to LLVM IR. For example, DWARF
83+
`discriminators <https://wiki.dwarfstd.org/Path_Discriminators.md>`_ allow
84+
SamplePGO to distinguish between multiple paths of execution which map to the
85+
same source line.
8186

8287
It would also be reasonable to use debug information to feed profiling tools
8388
for analysis of generated code, or, tools for reconstructing the original

0 commit comments

Comments
 (0)