public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9898] sparc: Preserve ORIGINAL_REGNO in epilogue_renumber [PR105257]
@ 2022-04-21 9:30 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-04-21 9:30 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:dfe099b4b5c0077a6bd699912fe9442431239e39
commit r11-9898-gdfe099b4b5c0077a6bd699912fe9442431239e39
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Apr 19 18:58:59 2022 +0200
sparc: Preserve ORIGINAL_REGNO in epilogue_renumber [PR105257]
The following testcase ICEs, because the pic register is
(reg:DI 24 %i0 [109]) and is used in the delay slot of a return.
We invoke epilogue_renumber and that changes it to
(reg:DI 8 %o0) which no longer satisfies sparc_pic_register_p
predicate, so we don't recognize the insn anymore.
The following patch fixes that by preserving ORIGINAL_REGNO if
specified, so we get (reg:DI 8 %o0 [109]) instead.
2022-04-19 Jakub Jelinek <jakub@redhat.com>
PR target/105257
* config/sparc/sparc.c (epilogue_renumber): If ORIGINAL_REGNO,
use gen_raw_REG instead of gen_rtx_REG and copy over also
ORIGINAL_REGNO. Use return 0; instead of /* fallthrough */.
* gcc.dg/pr105257.c: New test.
(cherry picked from commit eeca2b8bd03f57c59c6cf48bf6b9bd6dc86924f6)
Diff:
---
gcc/config/sparc/sparc.c | 16 ++++++++++++++--
gcc/testsuite/gcc.dg/pr105257.c | 16 ++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 7c8a1f18c39..0ef91935c1e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -8956,8 +8956,20 @@ epilogue_renumber (rtx *where, int test)
if (REGNO (*where) >= 8 && REGNO (*where) < 24) /* oX or lX */
return 1;
if (! test && REGNO (*where) >= 24 && REGNO (*where) < 32)
- *where = gen_rtx_REG (GET_MODE (*where), OUTGOING_REGNO (REGNO(*where)));
- /* fallthrough */
+ {
+ if (ORIGINAL_REGNO (*where))
+ {
+ rtx n = gen_raw_REG (GET_MODE (*where),
+ OUTGOING_REGNO (REGNO (*where)));
+ ORIGINAL_REGNO (n) = ORIGINAL_REGNO (*where);
+ *where = n;
+ }
+ else
+ *where = gen_rtx_REG (GET_MODE (*where),
+ OUTGOING_REGNO (REGNO (*where)));
+ }
+ return 0;
+
case SCRATCH:
case CC0:
case PC:
diff --git a/gcc/testsuite/gcc.dg/pr105257.c b/gcc/testsuite/gcc.dg/pr105257.c
new file mode 100644
index 00000000000..4232942d791
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr105257.c
@@ -0,0 +1,16 @@
+/* PR target/105257 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+
+extern int sigsetjmp (void **, int);
+void *buf[32];
+void (*fn) (void);
+
+const char *
+bar (void)
+{
+ sigsetjmp (buf, 0);
+ fn ();
+ return "";
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-21 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 9:30 [gcc r11-9898] sparc: Preserve ORIGINAL_REGNO in epilogue_renumber [PR105257] Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).