On 6/22/23 05:11, Philipp Tomsich wrote:
From: Manolis Tsamis <manolis.tsa...@vrull.eu>

Fixes: 6a2e8dcbbd4bab3

Propagation for the stack pointer in regcprop was enabled in
6a2e8dcbbd4bab3, but set ORIGINAL_REGNO/REG_ATTRS/REG_POINTER for
stack_pointer_rtx which caused regression (e.g., PR 110313, PR 110308).

This fix adds special handling for stack_pointer_rtx in the places
where maybe_mode_change is called. This also adds an check in
maybe_mode_change to return the stack pointer only when the requested
mode matches the mode of stack_pointer_rtx.

        PR 110308
Should be
        PR debug/110308



gcc/ChangeLog:

        * regcprop.cc (maybe_mode_change): Check stack_pointer_rtx mode.
        (find_oldest_value_reg): Special handling of stack_pointer_rtx.
        (copyprop_hardreg_forward_1): Ditto.

gcc/testsuite/ChangeLog:

        * g++.dg/torture/pr110308.C: New test.
I don't doubt the need for the special handling of the stack pointer, but it's not obvious why it's needed. So my request is that both humks which specialize handling of ORIGINAL_REGNO, REG_ATTRS & REG_POINTER have a comment indicating why we must not adjust those values when NEW_RTX is STACK_POINTER_RTX.

OK with that change.

Jeff

Reply via email to