On 1/8/25 4:14 PM, H.J. Lu wrote:
On Thu, Jan 9, 2025 at 5:35 AM Jeff Law <jeffreya...@gmail.com> wrote:
On 1/8/25 1:53 PM, H.J. Lu wrote:
Skip extension on stack pointer since we can't turn
(insn 27 26 139 2 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10])))
(clobber (reg:CC 17 flags))
]) "x.ii":14:17 discrim 1 283 {*addsi_1}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
...
(insn 43 125 74 2 (set (reg/f:DI 6 bp [145])
(zero_extend:DI (reg/f:SI 7 sp))) "x.ii":15:9 175 {*zero_extendsidi2}
(nil))
into
(insn 27 26 155 2 (parallel [
(set (reg:DI 6 bp)
(zero_extend:DI (plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10]))))
(clobber (reg:CC 17 flags))
]) "x.ii":14:17 discrim 1 296 {addsi_1_zext}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
(insn 155 27 139 2 (set (reg:DI 7 sp)
(reg:DI 6 bp)) "x.ii":14:17 discrim 1 -1
(nil))
without updating stack frame info.
FWIW, I think the stack update was a canary for a bigger issue here.
gcc/
PR rtl-optimization/118266
* ree.cc (add_removable_extension): Skip extension on stack
pointer.
gcc/testsuite/
PR rtl-optimization/118266
* gcc.target/i386/pr118266.c: New test.
Presumably there were no other uses of sp?
There are many uses of sp, including sp update, push and pop.
Thanks. I can speculate about multiple possible bad scenarios around
fixed registers, so thanks for adjusting.
jeff