Skip to content

Commit ac93554

Browse files
authored
Refine the examples in the debug info document (#86272)
This PR modifies the examples of section "When to merge instruction locations" in [HowToUpdateDebugInfo](https://llvm.org/docs/HowToUpdateDebugInfo.html) according to [the discussion](https://discourse.llvm.org/t/debuginfo-merging-instruction-locations-of-hoisted-instructions/77357), revise one misleading counterexample and refining the description of hoisting identical instructions.
1 parent 738abb9 commit ac93554

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

llvm/docs/HowToUpdateDebugInfo.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ misattributed to a block containing one of the instructions-to-be-merged.
9191

9292
Examples of transformations that should follow this rule include:
9393

94-
* Merging identical loads/stores which occur on both sides of a CFG diamond
95-
(see the ``MergedLoadStoreMotion`` pass).
94+
* Hoisting identical instructions from all successors of a conditional branch
95+
or sinking those from all paths to a postdominating block. For example,
96+
merging identical loads/stores which occur on both sides of a CFG diamond
97+
(see the ``MergedLoadStoreMotion`` pass). For each group of identical
98+
instructions being hoisted/sunk, the merge of all their locations should be
99+
applied to the merged instruction.
96100

97101
* Merging identical loop-invariant stores (see the LICM utility
98102
``llvm::promoteLoopAccessesToScalars``).
@@ -115,9 +119,11 @@ Examples of transformations for which this rule *does not* apply include:
115119
single-stepping experience. The rule for
116120
:ref:`dropping locations<WhenToDropLocation>` should apply here.
117121

118-
* Hoisting identical instructions which appear in several successor blocks into
119-
a predecessor block (see ``BranchFolder::HoistCommonCodeInSuccs``). In this
120-
case there is no single merged instruction. The rule for
122+
* Hoisting/sinking that would make a location reachable when it previously
123+
wasn't. Consider hoisting two identical instructions with the same location
124+
from first two cases of a switch that has three cases. Merging their
125+
locations would make the location from the first two cases reachable when the
126+
third case is taken. The rule for
121127
:ref:`dropping locations<WhenToDropLocation>` applies.
122128

123129
.. _WhenToDropLocation:

0 commit comments

Comments
 (0)