From 1a880ef2110aaa2c03b6eb88ef792d324b89f566 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 6 Dec 2019 19:30:37 +0000 Subject: [PATCH] re PR rtl-optimization/92176 (LRA problem with reloads for subreg operands) 2019-12-06 Andreas Krebbel Vladimir Makarov PR rtl-optimization/92176 * lra.c (simplify_subreg_regno): Don't permit unconditional changing mode for LRA too. 2019-12-06 Andreas Krebbel Vladimir Makarov PR rtl-optimization/92176 * gcc.target/s390/pr92176.c: New test. Co-Authored-By: Vladimir Makarov From-SVN: r279061 --- gcc/ChangeLog | 7 ++++++ gcc/rtlanal.c | 4 +-- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gcc.target/s390/pr92176.c | 33 +++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/pr92176.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58969ceb3b9..09cba3d576a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-12-06 Andreas Krebbel + Vladimir Makarov + + PR rtl-optimization/92176 + * lra.c (simplify_subreg_regno): Don't permit unconditional + changing mode for LRA too. + 2019-12-06 Richard Sandiford * target.h (TCTX_ALLOCATION, TCTX_DEALLOCATION, TCTX_EXCEPTIONS) diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 241a35b0e6c..b0c8cd5595a 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -3951,9 +3951,7 @@ simplify_subreg_regno (unsigned int xregno, machine_mode xmode, /* Give the backend a chance to disallow the mode change. */ if (GET_MODE_CLASS (xmode) != MODE_COMPLEX_INT && GET_MODE_CLASS (xmode) != MODE_COMPLEX_FLOAT - && !REG_CAN_CHANGE_MODE_P (xregno, xmode, ymode) - /* We can use mode change in LRA for some transformations. */ - && ! lra_in_progress) + && !REG_CAN_CHANGE_MODE_P (xregno, xmode, ymode)) return -1; /* We shouldn't simplify stack-related registers. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13a4744f1dc..360d1a9823c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-12-06 Andreas Krebbel + Vladimir Makarov + + PR rtl-optimization/92176 + * gcc.target/s390/pr92176.c: New test. + 2019-12-06 Martin Sebor * gcc.dg/Wstringop-overflow-23.c: Use the correct argument type. diff --git a/gcc/testsuite/gcc.target/s390/pr92176.c b/gcc/testsuite/gcc.target/s390/pr92176.c new file mode 100644 index 00000000000..62c483f1282 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr92176.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z13 -mzarch" } */ + +int a = 5, b, c, d, g, h, k, l, m, o; +static int e[7]; +int *volatile i = &d; +long long j; + +short p(int f, int dummy) { + k = 0 != (*e = m); + j = 0; + for (; j < 59; j = j + 1) + *i |= b; + g = 1; + for (; g <= 4; g++) { + o = 0; + for (; o <= 4; o++) + i = (int * volatile)(long)l; + } + return 42; +} + +void +q() { + char *n = (char*)&b; + + (*n = a) == p(e[6], c); + for (; h;) + for (;;) + ; +} + +/* { dg-final { scan-assembler-not {(?n)^\tvsteb\t.+,0$} } } */ -- 2.30.2