[llvm] Refine the examples in the debug info document (PR #86272)

Shan Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 05:16:17 PDT 2024


https://github.com/Apochens created https://github.com/llvm/llvm-project/pull/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), removing one misleading counterexample and refining the description of hoisting identical instructions.

>From 7727a9d99398494cd6ab58983b3e67ac859e9256 Mon Sep 17 00:00:00 2001
From: Apochens <52285902006 at stu.ecnu.edu.cn>
Date: Fri, 22 Mar 2024 12:08:52 +0000
Subject: [PATCH] refine the examples of merging locations

---
 llvm/docs/HowToUpdateDebugInfo.rst | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/llvm/docs/HowToUpdateDebugInfo.rst b/llvm/docs/HowToUpdateDebugInfo.rst
index c64b5d1d0d98b6..1e36c0c45c8490 100644
--- a/llvm/docs/HowToUpdateDebugInfo.rst
+++ b/llvm/docs/HowToUpdateDebugInfo.rst
@@ -91,8 +91,11 @@ misattributed to a block containing one of the instructions-to-be-merged.
 
 Examples of transformations that should follow this rule include:
 
-* Merging identical loads/stores which occur on both sides of a CFG diamond
-  (see the ``MergedLoadStoreMotion`` pass).
+* Hoisting identical instructions from successors of a conditional branch. For
+  example, merging identical loads/stores which occur on both sides of a CFG
+  diamond (see the ``MergedLoadStoreMotion`` pass). If there are more than one
+  group of identical instructions hoisted, apply merging instruction locations
+  for each single merged instruction.
 
 * Merging identical loop-invariant stores (see the LICM utility
   ``llvm::promoteLoopAccessesToScalars``).
@@ -115,11 +118,6 @@ Examples of transformations for which this rule *does not* apply include:
   single-stepping experience. The rule for
   :ref:`dropping locations<WhenToDropLocation>` should apply here.
 
-* Hoisting identical instructions which appear in several successor blocks into
-  a predecessor block (see ``BranchFolder::HoistCommonCodeInSuccs``). In this
-  case there is no single merged instruction. The rule for
-  :ref:`dropping locations<WhenToDropLocation>` applies.
-
 .. _WhenToDropLocation:
 
 When to drop an instruction location



More information about the llvm-commits mailing list