diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 75c59577815..43154ea912d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-04 Jakub Jelinek + + PR middle-end/67452 + * tree-ssa-live.c: Include cfgloop.h. + (remove_unused_locals): Clear loop->simduid if simduid is about + to be removed from cfun->local_decls. + 2015-09-02 Senthil Kumar Selvaraj PR target/65210 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47b8700c5fd..fdec9659831 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-04 Jakub Jelinek + + PR middle-end/67452 + * gcc.dg/lto/pr67452_0.c: New test. + 2015-09-02 Senthil Kumar Selvaraj PR target/65210 diff --git a/gcc/testsuite/gcc.dg/lto/pr67452_0.c b/gcc/testsuite/gcc.dg/lto/pr67452_0.c new file mode 100644 index 00000000000..a4984ffcc9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr67452_0.c @@ -0,0 +1,23 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -flto -fopenmp-simd } } } */ + +float b[3][3]; + +__attribute__((used, noinline)) void +foo () +{ + int v1, v2; +#pragma omp simd collapse(2) + for (v1 = 0; v1 < 3; v1++) + for (v2 = 0; v2 < 3; v2++) + b[v1][v2] = 2.5; +} + +int +main () +{ + asm volatile ("" : : "g" (b) : "memory"); + foo (); + asm volatile ("" : : "g" (b) : "memory"); + return 0; +} diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 47725585be9..e944a9ac191 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "cgraph.h" #include "ipa-utils.h" +#include "cfgloop.h" #ifdef ENABLE_CHECKING static void verify_live_on_entry (tree_live_info_p); @@ -820,6 +821,14 @@ remove_unused_locals (void) } } + if (cfun->has_simduid_loops) + { + struct loop *loop; + FOR_EACH_LOOP (loop, 0) + if (loop->simduid && !is_used_p (loop->simduid)) + loop->simduid = NULL_TREE; + } + cfun->has_local_explicit_reg_vars = false; /* Remove unmarked local and global vars from local_decls. */