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

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 16:46:18 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.
----------------
echristo wrote:

How's the updated comment? 'cause yeah, that's not the most elaborative. :)

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


More information about the llvm-commits mailing list