https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86455
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> --- Created attachment 44391 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44391&action=edit Reproducer patch, splits push Reproduced without the fkeep-vars-live patch. Consider this test-case: ... static volatile int vv = 1; static volatile int z; static long __attribute__((noinline, noclone)) foo (long x) { z = x; } int main () { long x = vv; foo (x); foo (x + 1); return 0; } ... which at -O1 -g -fpeephole2 contains a pushq at the start of main: ... .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 ... Using this debug patch: ... diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 8e800960b6d..0a2ac16b914 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -10213,7 +10213,11 @@ vt_initialize (void) } cselib_hook_called = false; + fprintf (stderr, "ORIGINAL: \n"); + debug_rtx (insn); adjust_insn (bb, insn); + fprintf (stderr, "ADJUSTED: \n"); + debug_rtx (insn); if (DEBUG_MARKER_INSN_P (insn)) { reemit_marker_as_note (insn); ... we can observe the var-tracking translation of the push: ... ORIGINAL: (insn/f 26 3 27 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8]) (reg:DI 3 bx)) "clztest.c":12 61 {*pushdi2_rex64} (expr_list:REG_DEAD (reg:DI 3 bx) (nil))) ADJUSTED: (insn/f 26 3 27 2 (parallel [ (set (mem:DI (plus:DI (reg/f:DI 16 argp) (const_int -24 [0xffffffffffffffe8])) [0 S8 A8]) (reg:DI 3 bx)) (set (reg/f:DI 7 sp) (plus:DI (reg/f:DI 16 argp) (const_int -24 [0xffffffffffffffe8]))) ]) "clztest.c":12 61 {*pushdi2_rex64} (expr_list:REG_DEAD (reg:DI 3 bx) (nil))) ... Now, using the reproducer patch, we split up the push: ... .cfi_startproc leaq -8(%rsp), %rsp .cfi_def_cfa_offset 16 movq %rbx, (%rsp) .cfi_offset 3, -16 ... and once more observe the var-tracking translation, now of the split up push: ... ORIGINAL: (insn/f 34 3 35 2 (set (reg/f:DI 7 sp) (plus:DI (reg/f:DI 7 sp) (const_int -8 [0xfffffffffffffff8]))) "clztest.c":12 228 {*leadi} (nil)) ADJUSTED: (insn/f 34 3 35 2 (set (reg/f:DI 7 sp) (plus:DI (reg/f:DI 16 argp) (const_int -16 [0xfffffffffffffff0]))) "clztest.c":12 228 {*leadi} (nil)) ORIGINAL: (insn/f 35 34 27 2 (set (mem:DI (reg/f:DI 7 sp) [0 S8 A8]) (reg:DI 3 bx)) "clztest.c":12 85 {*movdi_internal} (nil)) ADJUSTED: (insn/f 35 34 27 2 (set (mem:DI (plus:DI (reg/f:DI 16 argp) (const_int -16 [0xfffffffffffffff0])) [0 S8 A8]) (reg:DI 3 bx)) "clztest.c":12 85 {*movdi_internal} (nil)) ... Interestingly, the argp offset changed from -24 to -16.