From: Alan Hayward Date: Wed, 15 Jun 2016 10:53:01 +0000 (+0000) Subject: re PR tree-optimization/71439 (wrong code at -O3 in 32-bit and 64-bit mode on x86_64... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f482165c975f0a8410e3c8ecb0c011d409062d9;p=gcc.git re PR tree-optimization/71439 (wrong code at -O3 in 32-bit and 64-bit mode on x86_64-linux-gnu) 2016-06-15 Alan Hayward gcc/ PR tree-optimization/71439 * tree-vect-loop.c (vect_analyze_loop_operations): Additional check for live PHIs. testsuite/ PR tree-optimization/71439 * gcc.dg/vect/pr71439.c: New From-SVN: r237476 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6eb52a93975..568d385a10f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-15 Alan Hayward + + PR tree-optimization/71439 + * tree-vect-loop.c (vect_analyze_loop_operations): Additional check for + live PHIs. + 2016-06-15 Kyrylo Tkachov * ifcvt.c (bb_ok_for_noce_multiple_sets): Allow simple lowpart diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e5100ab6892..9e332a264e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-15 Alan Hayward + + PR tree-optimization/71439 + * gcc.dg/vect/pr71439.c: New + 2016-06-15 Kyrylo Tkachov * gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/pr71439.c b/gcc/testsuite/gcc.dg/vect/pr71439.c new file mode 100644 index 00000000000..95e4763bad6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71439.c @@ -0,0 +1,17 @@ +#include "tree-vect.h" + +int a, b, c; +short fn1(int p1, int p2) { return p1 + p2; } + +int main() { + a = 0; + for (; a < 30; a = fn1(a, 4)) { + c = b; + b = 6; + } + + if (c != 6) + abort (); + + return 0; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 91d0608e59c..4c8678505df 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1669,7 +1669,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) gcc_assert (stmt_info); - if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_scope + if ((STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_scope + || STMT_VINFO_LIVE_P (stmt_info)) && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def) { /* A scalar-dependence cycle that we don't support. */ @@ -1686,6 +1687,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) ok = vectorizable_induction (phi, NULL, NULL); } + if (ok && STMT_VINFO_LIVE_P (stmt_info)) + ok = vectorizable_live_operation (phi, NULL, NULL, -1, NULL); + if (!ok) { if (dump_enabled_p ())