aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Vieira <andre.simoesdiasvieira@arm.com>2021-02-22 13:41:46 +0000
committerAndre Vieira <andre.simoesdiasvieira@arm.com>2021-02-22 13:46:29 +0000
commit4c31a3a6d31b6214ea774d403bf8ab7ebe1ea862 (patch)
treeb78a35e66c65e7845b32cf0f0b126dad7e11f145
parente9b34037cdd196ab912a7ac3358f8a8d3e307e92 (diff)
downloadgcc-4c31a3a6d31b6214ea774d403bf8ab7ebe1ea862.zip
gcc-4c31a3a6d31b6214ea774d403bf8ab7ebe1ea862.tar.gz
gcc-4c31a3a6d31b6214ea774d403bf8ab7ebe1ea862.tar.bz2
ira: Make sure allocno copies are ordered [PR98791]
gcc/ChangeLog: 2021-02-22 Andre Vieira <andre.simoesdiasvieira@arm.com> PR rtl-optimization/98791 * ira-conflicts.c (process_regs_for_copy): Don't create allocno copies for unordered modes. gcc/testsuite/ChangeLog: 2021-02-22 Andre Vieira <andre.simoesdiasvieira@arm.com> PR rtl-optimization/98791 * gcc.target/aarch64/sve/pr98791.c: New test.
-rw-r--r--gcc/ira-conflicts.c5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr98791.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 2c22347..d83cfc1 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -275,7 +275,10 @@ process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p,
ira_allocno_t a1 = ira_curr_regno_allocno_map[REGNO (reg1)];
ira_allocno_t a2 = ira_curr_regno_allocno_map[REGNO (reg2)];
- if (!allocnos_conflict_for_copy_p (a1, a2) && offset1 == offset2)
+ if (!allocnos_conflict_for_copy_p (a1, a2)
+ && offset1 == offset2
+ && ordered_p (GET_MODE_PRECISION (ALLOCNO_MODE (a1)),
+ GET_MODE_PRECISION (ALLOCNO_MODE (a2))))
{
cp = ira_add_allocno_copy (a1, a2, freq, constraint_p, insn,
ira_curr_loop_tree_node);
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98791.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98791.c
new file mode 100644
index 0000000..cc1f183
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98791.c
@@ -0,0 +1,12 @@
+/* PR rtl-optimization/98791 */
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize" } */
+#include <arm_sve.h>
+extern char a[11];
+extern long b[];
+void f() {
+ for (int d; d < 10; d++) {
+ a[d] = svaddv(svptrue_b8(), svdup_u8(0));
+ b[d] = 0;
+ }
+}