aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2016-08-01 14:33:23 +0000
committerAlan Hayward <alan.hayward@arm.com>2016-08-01 14:33:23 +0000
commit9f484d572fb7f2db9dce28e7ac49ac3a3e92330a (patch)
tree0c23f044f302a6722804484bf9304b6a52934064
parenta4f0c61044afe963231a33312fb7259846612133 (diff)
2016-08-01 Alan Hayward <alan.hayward@arm.com>
gcc/ PR tree-optimization/71818 * tree-vect-loop-manip.c (vect_can_advance_ivs_p): Don't advance IVs with non invariant evolutions testsuite/ PR tree-optimization/71818 * gcc.dg/vect/pr71818.c: New git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@238955 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr71818.c16
-rw-r--r--gcc/tree-vect-loop-manip.c19
4 files changed, 45 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5643ceaae3..e97f2ccc630 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-01 Alan Hayward <alan.hayward@arm.com>
+
+ PR tree-optimization/71818
+ * tree-vect-loop-manip.c (vect_can_advance_ivs_p): Don't advance IVs
+ with non invariant evolutions
+
2016-08-01 Georg-Johann Lay <avr@gjlay.de>
PR target/72767
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2e015d927da..8b65b3ee01f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-01 Alan Hayward <alan.hayward@arm.com>
+
+ PR tree-optimization/71818
+ * gcc.dg/vect/pr71818.c: New
+
2016-08-01 Martin Liska <mliska@suse.cz>
PR tree-optimization/71857
diff --git a/gcc/testsuite/gcc.dg/vect/pr71818.c b/gcc/testsuite/gcc.dg/vect/pr71818.c
new file mode 100644
index 00000000000..2946551f8bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr71818.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+char a;
+short b;
+int c, d;
+void fn1() {
+ char e = 75, g;
+ unsigned char *f = &e;
+ a = 21;
+ for (; a <= 48; a++) {
+ for (; e <= 6;)
+ ;
+ g -= e -= b || g <= c;
+ }
+ d = *f;
+}
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index c1381b366cf..ec863b4af1f 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-vectorizer.h"
+#include "tree-ssa-loop-ivopts.h"
/*************************************************************************
Simple Loop Peeling Utilities
@@ -1592,10 +1593,26 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
}
/* FORNOW: We do not transform initial conditions of IVs
+ which evolution functions are not invariants in the loop. */
+
+ if (!expr_invariant_in_loop_p (loop, evolution_part))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "evolution not invariant in loop.\n");
+ return false;
+ }
+
+ /* FORNOW: We do not transform initial conditions of IVs
which evolution functions are a polynomial of degree >= 2. */
if (tree_is_chrec (evolution_part))
- return false;
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "evolution is chrec.\n");
+ return false;
+ }
}
return true;