On September 4, 2015 5:27:27 PM GMT+02:00, Jakub Jelinek <ja...@redhat.com> 
wrote:
>Hi!
>
>This patch is a fix for gomp4.1 branch ICEs on
>FAIL libgomp.c/for-5.c
>FAIL libgomp.c++/for-13.C
>that can be reproduced with intelmic emul offloading even on the trunk
>with the attached testcase.  The problem is that LTO streaming doesn't
>really like earlier unreferenced VAR_DECLs to be streamed late during
>output_function (from output_cfg).
>
>The patch fixes it by clearing loop->simduid when optimizations removed
>all IL uses of the var and remove_unused_locals is about to nuke it
>from
>cfun->local_decls.
>
>Ok for trunk/5.3 if it passes bootstrap/regtest?

OK.

Thanks,
Richard.

>2015-09-04  Jakub Jelinek  <ja...@redhat.com>
>
>       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.
>
>       * gcc.dg/lto/pr67452_0.c: New test.
>
>--- gcc/tree-ssa-live.c.jj     2015-08-24 18:27:19.738209359 +0200
>+++ gcc/tree-ssa-live.c        2015-09-04 17:16:53.620321240 +0200
>@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3.
> #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.  */
>--- gcc/testsuite/gcc.dg/lto/pr67452_0.c.jj    2015-09-04
>17:12:34.636045313 +0200
>+++ gcc/testsuite/gcc.dg/lto/pr67452_0.c       2015-09-04 17:13:18.473414952
>+0200
>@@ -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;
>+}
>
>       Jakub


Reply via email to