From f303100baaf48a54f07e9abd25ac37ebc95b641e Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 24 Jun 2015 06:50:53 +0000 Subject: PR66306: Fix match_dups on swapped operands. 2015-06-24 Andreas Krebbel PR rtl-optimization/66306 * reload.c (find_reloads): Swap the match_dup info for commutative operands. 2015-06-24 Andreas Krebbel PR rtl-optimization/66306 * gcc.target/s390/pr66306.c: New test. From-SVN: r224875 --- gcc/ChangeLog | 6 ++++++ gcc/reload.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/s390/pr66306.c | 26 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/pr66306.c (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be625c5..d1f82b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-06-24 Andreas Krebbel + PR rtl-optimization/66306 + * reload.c (find_reloads): Swap the match_dup info for + commutative operands. + +2015-06-24 Andreas Krebbel + * config/s390/vx-builtins.md ("vec_scatter_element_") ("vec_scatter_element_SI"): Replace gf mode diff --git a/gcc/reload.c b/gcc/reload.c index 03354de..1dc04bf 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -3872,6 +3872,12 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known, std::swap (*recog_data.operand_loc[commutative], *recog_data.operand_loc[commutative + 1]); + for (i = 0; i < recog_data.n_dups; i++) + if (recog_data.dup_num[i] == commutative + || recog_data.dup_num[i] == commutative + 1) + *recog_data.dup_loc[i] + = recog_data.operand[(int) recog_data.dup_num[i]]; + for (i = 0; i < n_reloads; i++) { if (rld[i].opnum == commutative) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d143157..8e28edc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2015-06-24 Andreas Krebbel + PR rtl-optimization/66306 + * gcc.target/s390/pr66306.c: New test. + +2015-06-24 Andreas Krebbel + * gcc.target/s390/vector/vec-abi-1.c: Add gnu attribute check. * gcc.target/s390/vector/vec-abi-attr-1.c: New test. * gcc.target/s390/vector/vec-abi-attr-2.c: New test. diff --git a/gcc/testsuite/gcc.target/s390/pr66306.c b/gcc/testsuite/gcc.target/s390/pr66306.c new file mode 100644 index 0000000..73903cb --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr66306.c @@ -0,0 +1,26 @@ +/* This caused an ICE on s390x due to a reload bug handling + commutative constraints. */ + +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +struct line_map +{ + unsigned start_location; + unsigned ordinary; +}; +unsigned +linemap_resolve_location (struct line_map **loc_map); + +unsigned +linemap_position_for_loc_and_offset (unsigned h, unsigned loc) +{ + struct line_map *map = 0; + linemap_resolve_location (&map); + + if (map->ordinary <= loc + map->start_location + map->ordinary) + __builtin_abort (); + + if (h >= loc + map->start_location) + __builtin_abort (); +} -- cgit v1.1