diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2019-02-12 14:51:39 +0000 |
---|---|---|
committer | Ilya Leoshkevich <iii@gcc.gnu.org> | 2019-02-12 14:51:39 +0000 |
commit | dd0df13685e22b0300c4dfd0733303bf2b4b804a (patch) | |
tree | 8a07a2f8f1f075a0d1e889ad7605018d576d6f9e | |
parent | 8ced066037201d2c193560bf7d9cd6e738e26e55 (diff) | |
download | gcc-dd0df13685e22b0300c4dfd0733303bf2b4b804a.zip gcc-dd0df13685e22b0300c4dfd0733303bf2b4b804a.tar.gz gcc-dd0df13685e22b0300c4dfd0733303bf2b4b804a.tar.bz2 |
S/390: Reject invalid Q/R/S/T addresses after LRA
The following insn:
(insn (set (reg:DI %r2)
(sign_extend:DI (mem:SI
(const:DI (plus:DI (symbol_ref:DI ("*.LC0"))
(const_int 16)))))))
is correctly recognized by LRA as RIL alternative of extendsidi2
define_insn. However, when recognition runs after LRA, it returns RXY
alternative, which is incorrect, since the offset 16 points past the
end of of *.LC0 literal pool entry. Such addresses are normally
rejected by s390_decompose_address ().
This inconsistency confuses annotate_constant_pool_refs: the selected
alternative makes it proceed with annotation, only to find that the
annotated address is invalid, causing ICE.
This patch fixes the root cause, namely, that s390_check_qrst_address ()
behaves differently during and after LRA.
gcc/ChangeLog:
2019-02-12 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/89233
* config/s390/s390.c (s390_decompose_address): Update comment.
(s390_check_qrst_address): Reject invalid address forms after
LRA.
gcc/testsuite/ChangeLog:
2019-02-12 Ilya Leoshkevich <iii@linux.ibm.com>
PR target/89233
* gcc.target/s390/pr89233.c: New test.
From-SVN: r268798
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/pr89233.c | 11 |
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4cf4f01..3c90ff8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-02-12 Ilya Leoshkevich <iii@linux.ibm.com> + + PR target/89233 + * config/s390/s390.c (s390_decompose_address): Update comment. + (s390_check_qrst_address): Reject invalid address forms after + LRA. + 2019-02-12 Martin Liska <mliska@suse.cz> PR lto/88876 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6a571a3..713973a 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3020,7 +3020,9 @@ s390_decompose_address (rtx addr, struct s390_address *out) if (offset) { /* If we have an offset, make sure it does not - exceed the size of the constant pool entry. */ + exceed the size of the constant pool entry. + Otherwise we might generate an out-of-range + displacement for the base register form. */ rtx sym = XVECEXP (disp, 0, 0); if (offset >= GET_MODE_SIZE (get_pool_mode (sym))) return false; @@ -3193,8 +3195,10 @@ s390_check_qrst_address (char c, rtx op, bool lit_pool_ok) generic cases below ('R' or 'T'), since reload will in fact fix them up. LRA behaves differently here; we never see such forms, but on the other hand, we need to strictly reject every invalid - address form. Perform this check right up front. */ - if (lra_in_progress) + address form. After both reload and LRA invalid address forms + must be rejected, because nothing will fix them up later. Perform + this check right up front. */ + if (lra_in_progress || reload_completed) { if (!decomposed && !s390_decompose_address (op, &addr)) return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index adfe1ae..7cb2c41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-12 Ilya Leoshkevich <iii@linux.ibm.com> + + PR target/89233 + * gcc.target/s390/pr89233.c: New test. + 2018-01-12 Bill Schmidt <wschmidt@linux.ibm.com> * gcc.target/powerpc/vec-sld-modulo.c: Require p8vector_hw. diff --git a/gcc/testsuite/gcc.target/s390/pr89233.c b/gcc/testsuite/gcc.target/s390/pr89233.c new file mode 100644 index 0000000..f572bfa --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr89233.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=z13 -O1" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +int +f () +{ + v4si x = {0, 1, 2, 3}; + return x[4]; +} |