]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/60903 (ICE: in verify_loop_structure, at cfgloop.c:1647:...
authorRichard Biener <rguenther@suse.de>
Wed, 23 Apr 2014 11:25:27 +0000 (11:25 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 23 Apr 2014 11:25:27 +0000 (11:25 +0000)
2014-04-23  Richard Biener  <rguenther@suse.de>

PR tree-optimization/60903
* tree-ssa-loop-im.c (analyze_memory_references): Remove
commented code block.
(execute_sm_if_changed): Properly apply IRREDUCIBLE_LOOP
loop flags to newly created BBs and edges.

* gcc.dg/torture/pr60903.c: New testcase.

From-SVN: r209694

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr60903.c [new file with mode: 0644]
gcc/tree-ssa-loop-im.c

index 0fe6f7bbe6e3ccab27b82772dc3a4dcd55952f52..0a6cb55e9424dcf8fddf28e8dc2f3d70eb554ff5 100644 (file)
@@ -1,3 +1,11 @@
+2014-04-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/60903
+       * tree-ssa-loop-im.c (analyze_memory_references): Remove
+       commented code block.
+       (execute_sm_if_changed): Properly apply IRREDUCIBLE_LOOP
+       loop flags to newly created BBs and edges.
+
 2014-04-23  Nick Clifton  <nickc@redhat.com>
 
        * config/msp430/msp430.c (msp430_handle_option): Move function
index d05337748b0092f262e72031350c82ded18fe661..e74096c9ddc0eaf770219592137252ac6728a5b5 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/60903
+       * gcc.dg/torture/pr60903.c: New testcase.
+
 2014-04-23  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/60895
diff --git a/gcc/testsuite/gcc.dg/torture/pr60903.c b/gcc/testsuite/gcc.dg/torture/pr60903.c
new file mode 100644 (file)
index 0000000..5d93ae3
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+extern int a, b, k, q;
+
+void
+foo ()
+{
+  if (a)
+    {
+      while (q)
+       {
+       lbl:
+         if (a)
+           {
+             a = 0;
+             goto lbl;
+           }
+       }
+      b = k;
+    }
+  goto lbl;
+}
index 0b44c977fdd534909b6d409bd1bb422118eea00d..54156d7118b78c6f61c18707b93380c9c58f45e9 100644 (file)
@@ -1544,15 +1544,6 @@ analyze_memory_references (void)
   struct loop *loop, *outer;
   unsigned i, n;
 
-#if 0
-  /* Initialize bb_loop_postorder with a mapping from loop->num to
-     its postorder index.  */
-  i = 0;
-  bb_loop_postorder = XNEWVEC (unsigned, number_of_loops (cfun));
-  FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
-    bb_loop_postorder[loop->num] = i++;
-#endif
-
   /* Collect all basic-blocks in loops and sort them after their
      loops postorder.  */
   i = 0;
@@ -1807,6 +1798,7 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
   gimple_stmt_iterator gsi;
   gimple stmt;
   struct prev_flag_edges *prev_edges = (struct prev_flag_edges *) ex->aux;
+  bool irr = ex->flags & EDGE_IRREDUCIBLE_LOOP;
 
   /* ?? Insert store after previous store if applicable.  See note
      below.  */
@@ -1821,8 +1813,9 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
   old_dest = ex->dest;
   new_bb = split_edge (ex);
   then_bb = create_empty_bb (new_bb);
-  if (current_loops && new_bb->loop_father)
-    add_bb_to_loop (then_bb, new_bb->loop_father);
+  if (irr)
+    then_bb->flags = BB_IRREDUCIBLE_LOOP;
+  add_bb_to_loop (then_bb, new_bb->loop_father);
 
   gsi = gsi_start_bb (new_bb);
   stmt = gimple_build_cond (NE_EXPR, flag, boolean_false_node,
@@ -1834,9 +1827,12 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
   stmt = gimple_build_assign (unshare_expr (mem), tmp_var);
   gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
 
-  make_edge (new_bb, then_bb, EDGE_TRUE_VALUE);
-  make_edge (new_bb, old_dest, EDGE_FALSE_VALUE);
-  then_old_edge = make_edge (then_bb, old_dest, EDGE_FALLTHRU);
+  make_edge (new_bb, then_bb,
+            EDGE_TRUE_VALUE | (irr ? EDGE_IRREDUCIBLE_LOOP : 0));
+  make_edge (new_bb, old_dest,
+            EDGE_FALSE_VALUE | (irr ? EDGE_IRREDUCIBLE_LOOP : 0));
+  then_old_edge = make_edge (then_bb, old_dest,
+                            EDGE_FALLTHRU | (irr ? EDGE_IRREDUCIBLE_LOOP : 0));
 
   set_immediate_dominator (CDI_DOMINATORS, then_bb, new_bb);