[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:15 PDT 2026


================
@@ -0,0 +1,96 @@
+; RUN: opt %s -S -passes=dse -o - | FileCheck %s --implicit-check-not="#dbg_"
+
+;; The IR is clang's, cleaned up but not otherwise adjusted, so the variable
+;; fills its alloca and the offsets are the ones clang emitted. That gives up
+;; the coverage shorten-offset.ll buys by adjusting them, and gets a source
+;; listing whose numbers can be checked against the test.
+;;
+;; $ cat shorten.c
+;; void esc(char *);
+;; void shortenBeginPartial(void) {
+;;   char local[80];
+;;   __builtin_memset(local + 8, 0, 72);
+;;   __builtin_memset(local + 4, 8, 64);
+;;   esc(local);
+;; }
+;;
+;; $ clang -O2 -g -c -Xclang -fexperimental-assignment-tracking=forced \
+;;       -mllvm -print-before=dse -mllvm -print-module-scope shorten.c \
+;;       -o /dev/null
+;;
+;; and then, by hand: dropped the target triple and datalayout so this runs
+;; anywhere, dropped the tbaa metadata, llvm.ident, the producer/checksum/
+;; sysroot strings, the key-instruction atoms, the lifetime intrinsics and the
----------------
OCHyams wrote:

doesn't matter massively but if you want to drop the key-instruction atoms anyway you can run with -gno-key-instructions 

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


More information about the llvm-commits mailing list