aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr84357.c31
-rw-r--r--gcc/tree-data-ref.c11
4 files changed, 46 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 22589ba..cc29440 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-14 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84357
+ * tree-data-ref.c (object_address_invariant_in_loop_p): Check
+ operand 1 of an ARRAY_REF too.
+
2018-02-14 Oleg Endo <olegendo@gcc.gnu.org>
PR target/83831
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 776542a..473a272 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-14 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84357
+ * gcc.dg/vect/pr84357.c: New test.
+
2018-02-14 Oleg Endo <olegendo@gcc.gnu.org>
PR target/83831
diff --git a/gcc/testsuite/gcc.dg/vect/pr84357.c b/gcc/testsuite/gcc.dg/vect/pr84357.c
new file mode 100644
index 0000000..cd3cc4a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr84357.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wall" } */
+
+#define COUNT 32
+
+typedef struct s1 {
+ unsigned char c;
+} s1;
+
+typedef struct s2
+{
+ char pad;
+ s1 arr[COUNT];
+} s2;
+
+typedef struct s3 {
+ s1 arr[COUNT];
+} s3;
+
+s2 * get_s2();
+s3 * gActiveS3;
+void foo()
+{
+ s3 * three = gActiveS3;
+ s2 * two = get_s2();
+
+ for (int i = 0; i < COUNT; i++)
+ {
+ two->arr[i].c = three->arr[i].c;
+ }
+}
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index fdb2ac1..a886329 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -2200,13 +2200,10 @@ object_address_invariant_in_loop_p (const struct loop *loop, const_tree obj)
{
if (TREE_CODE (obj) == ARRAY_REF)
{
- /* Index of the ARRAY_REF was zeroed in analyze_indices, thus we only
- need to check the stride and the lower bound of the reference. */
- if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (obj, 2),
- loop->num)
- || chrec_contains_symbols_defined_in_loop (TREE_OPERAND (obj, 3),
- loop->num))
- return false;
+ for (int i = 1; i < 4; ++i)
+ if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (obj, i),
+ loop->num))
+ return false;
}
else if (TREE_CODE (obj) == COMPONENT_REF)
{