diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2016-08-30 17:48:24 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-09-07 22:08:13 +0200 |
commit | 4ac66fe8866695a2eb46c555226fbbb9a7d8663f (patch) | |
tree | 9b12cda0b8a0165f1b133b4e5333acc8b19f541d | |
parent | 0c91810421cada476968b1501d0585e2289c3032 (diff) |
gcc/
Backport from trunk r238955.
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
gcc/testsuite/
Backport from trunk r238955.
2015-08-01 Alan Hayward <alan.hayward@arm.com>
PR tree-optimization/71818
* gcc.dg/vect/pr71818.c: New
Change-Id: I9962446c966ffe53e7000434447a002a2e7c9653
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr71818.c | 16 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 19 |
2 files changed, 34 insertions, 1 deletions
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 7ec6daec0e6..72c71ed5412 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 @@ -1594,10 +1595,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; |