[llvm] Refine the examples in the debug info document (PR #86272)
Shan Huang via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 19:46:25 PDT 2024
================
@@ -91,8 +91,12 @@ 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 or
----------------
Apochens wrote:
@dwblaikie Hi, I think I find the case you mentioned – the test [hoist-drop-debug-info.ll](https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/GVNHoist/hoist-drop-debug-info.ll) for GVNHoist. In this test, the control flow is shown below:
```
entry
/ | \
sw1 sw2 exit1
\ |
exit
```
There is a store instruction in each of `sw1`, `sw2`, and `exit1`, and GVNHoist replace all the store with a merged store in `entry`. As a result, GVNHoist drops the debug location of the merged store. [Here](https://github.com/llvm/llvm-project/blob/d9b6e9f1c1565d9469eb0546da8c276051175408/llvm/lib/Transforms/Scalar/GVNHoist.cpp#L1118) is the pass code. (IMO, since all stores in all paths through `entry` are hoisted, the debug locations could be merged. However, in this case they are dropped. I think the reason would be that `exit1` does not go to `exit`?)
Does this conform to what you say?
https://github.com/llvm/llvm-project/pull/86272
More information about the llvm-commits
mailing list