aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuozhi Wei <carrot@google.com>2014-10-22 15:56:59 +0000
committerWei Guozhi <carrot@gcc.gnu.org>2014-10-22 15:56:59 +0000
commit417dfefbdbc78eef2b6e9a2f70f153547c73b6e3 (patch)
treec465148bca93207b0514e1ba2c3d75362ab71f09
parent9612a39a41f7d66a303c0b6fa4e76aa739d12b9a (diff)
downloadgcc-417dfefbdbc78eef2b6e9a2f70f153547c73b6e3.zip
gcc-417dfefbdbc78eef2b6e9a2f70f153547c73b6e3.tar.gz
gcc-417dfefbdbc78eef2b6e9a2f70f153547c73b6e3.tar.bz2
re PR tree-optimization/63530 (GCC generates incorrect aligned store on ARM after the loop is unrolled.)
PR tree-optimization/63530 tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set pointer alignment according to DR_MISALIGNMENT. gcc.dg/vect/pr63530.c: New testcase. From-SVN: r216562
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr63530.c30
-rw-r--r--gcc/tree-vect-data-refs.c6
4 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1a46023..3687418 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-22 Guozhi Wei <carrot@google.com>
+
+ PR tree-optimization/63530
+ tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set
+ pointer alignment according to DR_MISALIGNMENT.
+
2014-10-22 David Malcolm <dmalcolm@redhat.com>
* ipa-icf.c (ipa_icf_driver): Set optimizer to NULL when done.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 964037a..5762e8f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-22 Guozhi Wei <carrot@google.com>
+
+ PR tree-optimization/63530
+ gcc.dg/vect/pr63530.c: New testcase.
+
2014-10-22 Richard Sandiford <richard.sandiford@arm.com>
* gcc.target/i386/conversion-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/pr63530.c b/gcc/testsuite/gcc.dg/vect/pr63530.c
new file mode 100644
index 0000000..b583b9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr63530.c
@@ -0,0 +1,30 @@
+/* { dg-options "-O2 -ftree-vectorize -funroll-loops --param \"max-completely-peeled-insns=400\"" } */
+
+/* PR tree-optimization/63530 */
+/* On armv7 hardware, following options cause run time failure */
+/* -march=armv7-a -mfloat-abi=hard -mfpu=neon -marm -O2 -ftree-vectorize */
+/* -funroll-loops --param "max-completely-peeled-insns=400" */
+
+#include <stdlib.h>
+
+typedef struct {
+ unsigned char map[256];
+ int i;
+} A, *AP;
+
+AP __attribute__ ((noinline))
+foo (int n)
+{
+ AP b = (AP)calloc (1, sizeof (A));
+ int i;
+ for (i = n; i < 256; i++)
+ b->map[i] = i;
+ return b;
+}
+
+int
+main()
+{
+ AP p = foo(3);
+ return p->map[30] - p->map[20] - p->map[10];
+}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 0807b95..66ba70a 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3960,8 +3960,12 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
&& TREE_CODE (addr_base) == SSA_NAME)
{
duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr));
- if (offset)
+ unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
+ int misalign = DR_MISALIGNMENT (dr);
+ if (offset || byte_offset || (misalign == -1))
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
+ else
+ set_ptr_info_alignment (SSA_NAME_PTR_INFO (addr_base), align, misalign);
}
if (dump_enabled_p ())