diff options
author | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-23 09:45:38 +0000 |
---|---|---|
committer | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-23 09:45:38 +0000 |
commit | 593bddd3dcaafcb473667cec43b26d17f4da0656 (patch) | |
tree | 006bc81b651c60e115e889c4144c6d622ef16fda | |
parent | 21017ecb28043065575a4e269837858b5b54eb0a (diff) | |
download | gcc-593bddd3dcaafcb473667cec43b26d17f4da0656.tar.gz |
Always call free_stmt_vec_info_vec in gather_scalar_reductions
2015-11-23 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68460
* tree-parloops.c (gather_scalar_reductions): Also call
free_stmt_vec_info_vec if simple_loop_info == NULL.
* gcc.dg/autopar/pr68460.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230742 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/autopar/pr68460.c | 35 | ||||
-rw-r--r-- | gcc/tree-parloops.c | 6 |
4 files changed, 51 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 16bb1aa3221..0b7f5d4c3c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-11-23 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/68460 + * tree-parloops.c (gather_scalar_reductions): Also call + free_stmt_vec_info_vec if simple_loop_info == NULL. + 2015-11-23 Maxim Ostapenko <m.ostapenko@partner.samsung.com> * opts.c (finish_options): Allow -fsanitize-recover=address for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8781283f606..2861d00d94b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-23 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/68460 + * gcc.dg/autopar/pr68460.c: New test. + 2015-11-23 Maxim Ostapenko <m.ostapenko@partner.samsung.com> * c-c++-common/asan/halt_on_error-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/autopar/pr68460.c b/gcc/testsuite/gcc.dg/autopar/pr68460.c new file mode 100644 index 00000000000..0c00065afbd --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr68460.c @@ -0,0 +1,35 @@ +/* { dg-do "compile" } */ +/* { dg-options "-O -ftree-parallelize-loops=2 -ftree-vectorize -fno-tree-ch -fno-tree-dominator-opts" } */ + +void abort (void); + +int d[1024], e[1024]; + +int +foo (void) +{ + int s = 0; + int i; + + for (i = 0; i < 1024; i++) + s += d[i] - e[i]; + + return s; +} + +int +main () +{ + int i; + + for (i = 0; i < 1024; i++) + { + d[i] = i * 2; + e[i] = i; + } + + if (foo () != 1023 * 1024 / 2) + abort (); + + return 0; +} diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index aca23704822..9b564cabcea 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2433,7 +2433,7 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list simple_loop_info = vect_analyze_loop_form (loop); if (simple_loop_info == NULL) - return; + goto gather_done; for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi)) { @@ -2492,9 +2492,13 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list destroy_loop_vec_info (simple_loop_info, true); destroy_loop_vec_info (simple_inner_loop_info, true); + gather_done: /* Release the claim on gimple_uid. */ free_stmt_vec_info_vec (); + if (reduction_list->elements () == 0) + return; + /* As gimple_uid is used by the vectorizer in between vect_analyze_loop_form and free_stmt_vec_info_vec, we can set gimple_uid of reduc_phi stmts only now. */ |