[debug] Fix pre_dec handling in vartrack
When compiling test-case gcc.target/i386/vartrack-1.c with -O1 -g, register bx
is pushed in the prologue and popped in the epilogue:
...
(insn/f 26 3 27 2
(set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8])
(reg:DI 3 bx))
"vartrack-1.c":10 61 {*pushdi2_rex64}
(expr_list:REG_DEAD (reg:DI 3 bx) (nil)))
...
(insn/f 29 28 30 2
(set (reg:DI 3 bx)
(mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0 S8 A8]))
"vartrack-1.c":15 71 {*popdi1}
(expr_list:REG_CFA_ADJUST_CFA
(set (reg/f:DI 7 sp)
(plus:DI (reg/f:DI 7 sp)
(const_int 8 [0x8]))) (nil)))
...
However, when we adjust those insns in vartrack to eliminate the pre_dec and
post_inc, the frame location for the push is at argp - 24, while the one for the
pop is at argp - 16:
...
(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])))
])
"vartrack-1.c":10 61 {*pushdi2_rex64}
(expr_list:REG_DEAD (reg:DI 3 bx) (nil)))
...
(insn/f 29 28 30 2
(parallel [
(set (reg:DI 3 bx)
(mem:DI (plus:DI (reg/f:DI 16 argp)
(const_int -16 [0xfffffffffffffff0])) [0 S8 A8]))
(set (reg/f:DI 7 sp)
(plus:DI (reg/f:DI 16 argp)
(const_int -8 [0xfffffffffffffff8])))
])
"vartrack-1.c":15 71 {*popdi1}
(expr_list:REG_CFA_ADJUST_CFA
(set (reg/f:DI 7 sp)
(plus:DI (reg/f:DI 7 sp)
(const_int 8 [0x8]))) (nil)))
...
This patch fixes that by moving the stack_adjust modification after
adjust_insn in vt_initialize.
Bootstrapped and reg-tested on x86_64.
2018-07-16 Tom de Vries <tdevries@suse.de>
PR debug/86455
* var-tracking.c (vt_initialize): Fix pre_dec handling.
* gcc.target/i386/vartrack-1.c: New test.
From-SVN: r262687