[llvm] [DSE] Stop double-counting the dead slice offset in shortenAssignment (PR #216227)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 01:03:16 PDT 2026


================
@@ -45,9 +60,24 @@
 ; CHECK-NEXT: #dbg_assign(i8 0, ![[VAR2:[0-9]+]], !DIExpression(), ![[ID2]], ptr %local2, !DIExpression(),
 ; CHECK-NEXT: #dbg_assign(i8 0, ![[VAR2]], !DIExpression(DW_OP_LLVM_fragment, 0, 128), ![[UniqueID2:[0-9]+]], ptr poison, !DIExpression(),
 
+;; DSE shortens the store in shortenEndPartial from bytes [8, 16) of 'local3'
+;; to [8, 12), so the dead bytes are [12, 16). The dbg.assign's address is
+;; %offset_4_bytes + 4, i.e. local3 + 8, where its fragment (64, 96) starts, so
+;; the dead bytes are variable bits [96, 128). Check we get an unlinked
+;; dbg.assign for (96, 32). Counting the dead store's offset from local3 twice
+;; pushes the slice past the end of the fragment instead, and nothing at all
+;; gets inserted.
----------------
OCHyams wrote:

> Counting the dead store's offset from local3 twice pushes the slice past the end of the fragment instead, and nothing at all gets inserted.

can you elaborate a bit on this? reading the comment it's not clear what you mean by double counting the offset. If that refers to the old broken behaviour, it seems not worth mentioning in the test.

https://github.com/llvm/llvm-project/pull/216227


More information about the llvm-commits mailing list