CRIS: Fix PR middle-end/113109; "throw" failing
commit3d03630b123411340e52d05124cb0cacfa1fc8b0
authorHans-Peter Nilsson <hp@axis.com>
Sat, 23 Dec 2023 23:10:32 +0000 (24 00:10 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Sun, 24 Dec 2023 00:40:58 +0000 (24 01:40 +0100)
tree1abacfddf0b38c46c4311c2835eb8b9c43395c17
parentd2ae7cb2ef9067f91e751b9914665d6b59f23478
CRIS: Fix PR middle-end/113109; "throw" failing

TL;DR: the "dse1" pass removed the eh-return-address store.  The
PA also marks its EH_RETURN_HANDLER_RTX as volatile, for the same
reason, as does visum.  See PR32769 - it's the same thing on PA.

Conceptually, it's logical that stores to incoming args are
optimized out on the return path or if no loads are seen -
at least before epilogue expansion, when the subsequent load
isn't seen in the RTL, as is the case for the "dse1" pass.

I haven't looked into why this problem, that appeared for the PA
already in 2007, was seen for CRIS only recently (with
r14-6674-g4759383245ac97).

PR middle-end/113109
* config/cris/cris.cc (cris_eh_return_handler_rtx): New function.
* config/cris/cris-protos.h (cris_eh_return_handler_rtx): Prototype.
* config/cris/cris.h (EH_RETURN_HANDLER_RTX): Redefine to call
cris_eh_return_handler_rtx.
gcc/config/cris/cris-protos.h
gcc/config/cris/cris.cc
gcc/config/cris/cris.h