re PR tree-optimization/80167 (ICE in translate_isl_ast_to_gimple::is_valid_rename...
authorRichard Biener <rguenther@suse.de>
Fri, 24 Mar 2017 12:16:43 +0000 (12:16 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 24 Mar 2017 12:16:43 +0000 (12:16 +0000)
2017-03-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/80167
* graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
properly.
(translate_isl_ast_to_gimple::get_rename): Likewise.

* gcc.dg/graphite/pr80167.c: New testcase.

From-SVN: r246438

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr80167.c [new file with mode: 0644]

index d1dcff022044bdc6ff193454f1cfad8de6ffd3fe..de9cd9036a102d6bbf8cf955edd29bc31e788c95 100644 (file)
@@ -1,3 +1,11 @@
+2017-03-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/80167
+       * graphite-isl-ast-to-gimple.c
+       (translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
+       properly.
+       (translate_isl_ast_to_gimple::get_rename): Likewise.
+
 2017-03-23  Kelvin Nilsen  <kelvin@gcc.gnu.org>
 
        * config/rs6000/rs6000.c (rs6000_option_override_internal): Change
index 3f082da76996b842ba90eaec97f9797d301a265e..54d07592d2dd8962f97aade223dc46acca94be52 100644 (file)
@@ -1123,6 +1123,9 @@ bool translate_isl_ast_to_gimple::
 is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
                 phi_node_kind phi_kind, tree old_name, basic_block old_bb) const
 {
+  if (SSA_NAME_IS_DEFAULT_DEF (rename))
+    return true;
+
   /* The def of the rename must either dominate the uses or come from a
      back-edge.  Also the def must respect the loop closed ssa form.  */
   if (!is_loop_closed_ssa_use (use_bb, rename))
@@ -1178,6 +1181,7 @@ get_rename (basic_block new_bb, tree old_name, basic_block old_bb,
          basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (rename));
          if (is_valid_rename (rename, bb, new_bb, phi_kind, old_name, old_bb)
              && (phi_kind == close_phi
+                 || ! bb
                  || flow_bb_inside_loop_p (bb->loop_father, new_bb)))
            return rename;
          return NULL_TREE;
index 84ba7aff45e49c602e4b594b1dbbc6820be246c4..78de19e09aaefdaa7e5787c3810dfa11e3c82c90 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/80167
+       * gcc.dg/graphite/pr80167.c: New testcase.
+
 2017-03-24  Tom de Vries  <tom@codesourcery.com>
 
        PR testsuite/80092
diff --git a/gcc/testsuite/gcc.dg/graphite/pr80167.c b/gcc/testsuite/gcc.dg/graphite/pr80167.c
new file mode 100644 (file)
index 0000000..990450b
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+typedef struct
+{
+  short a;
+  short b;
+  short c;
+} d;
+extern d e[];
+int f[8];
+void
+g (d *i)
+{
+  int h = 0;
+  for (; h < 28; h++)
+    e[h].a = e[h].b = i[h].a;
+  h = 0;
+  for (; h < 8; h++)
+    f[h] = i[h].b + i[h].c;
+  h = 0;
+  for (; h < 8; h++)
+    f[h] = i[h].b;
+}