[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
================
@@ -16,22 +16,37 @@
;; __builtin_memset(local2, 8, 16); // local2: 0-128 (0, 128)
;; esc(local2);
;; }
+;; void shortenEndPartial() {
+;; char local3[80]; // bits frag
+;; __builtin_memset(local3 + 8, 0, 8); // local3: 64-128 (64, 96)
+;; __builtin_memset(local3 + 12, 8, 4); // local3: 96-128 ( 96, 32)
+;; esc(local3);
+;; }
;; The variables and intrinsics have been adjusted with by hand to test
;; what happens when the variable doesn't fill the whole alloca, and
;; when offsets are encoded with both the address component of the dbg.assign
;; and the address modifying DIExpression.
-;; DeadStoreElimination will shorten the first store in shortenEnd from [64,
-;; 192) bits to [64, 128) bits. Variable 'local' has been adjusted to be 160
-;; bits large. Check that we get an unlinked dbg.assign covering the deleted
-;; bits that overlap the dbg.assign's fagment: [128, 160) (offset=128 size=32).
+;; 'local' and 'local3' have both been adjusted to be 160 bits, so the bit
+;; ranges above are the written bytes clamped to the variable.
+
+;; In shortenEnd the killing store starts before the dead one, at local + 4
+;; against local + 8, so despite the name it takes the overwrite-begin path.
----------------
OCHyams wrote:
> so despite the name
worth changing the name instead, if it doesn't fit?
https://github.com/llvm/llvm-project/pull/216227
More information about the llvm-commits
mailing list