]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/50672 (ice: verify_ssa failed: no immediate_use list)
authorTom de Vries <tom@codesourcery.com>
Tue, 18 Oct 2011 08:57:39 +0000 (08:57 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 18 Oct 2011 08:57:39 +0000 (08:57 +0000)
2011-10-18  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/50672
* tree-ssa-dce.c (mark_virtual_operand_for_renaming): New function,
factored out of ...
(mark_virtual_phi_result_for_renaming): Use
mark_virtual_operand_for_renaming.
* tree-flow.h (mark_virtual_operand_for_renaming): Declare.
* tree-ssa-tail-merge.c (release_last_vdef): New function.
(purge_bbs): Add update_vops parameter.  Call release_last_vdef for each
deleted basic block.
(tail_merge_optimize): Add argument to call to purge_bbs.

From-SVN: r180126

gcc/ChangeLog
gcc/tree-flow.h
gcc/tree-ssa-dce.c
gcc/tree-ssa-tail-merge.c

index 19f851d2dd43b406ebe2a7e22b489dd0aef9b149..5ef215e47ee99f65ac9e946e5351fec102bf9898 100644 (file)
@@ -1,3 +1,16 @@
+2011-10-18  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/50672
+       * tree-ssa-dce.c (mark_virtual_operand_for_renaming): New function,
+       factored out of ...
+       (mark_virtual_phi_result_for_renaming): Use
+       mark_virtual_operand_for_renaming.
+       * tree-flow.h (mark_virtual_operand_for_renaming): Declare.
+       * tree-ssa-tail-merge.c (release_last_vdef): New function.
+       (purge_bbs): Add update_vops parameter.  Call release_last_vdef for each
+       deleted basic block.
+       (tail_merge_optimize): Add argument to call to purge_bbs.
+
 2011-10-18  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/50716
index 1152b7d0de4660f45d919ec1be5c7bcb2b7236dc..dcfbb9da628b018c77ab0f76af6a714767c75371 100644 (file)
@@ -715,6 +715,7 @@ bool stmt_dominates_stmt_p (gimple, gimple);
 void mark_virtual_ops_for_renaming (gimple);
 
 /* In tree-ssa-dce.c */
+void mark_virtual_operand_for_renaming (tree);
 void mark_virtual_phi_result_for_renaming (gimple);
 
 /* In tree-ssa-threadedge.c */
index b84b6f9a99e64e838a1c183a7c4db8463860f86f..5a6a38e63e9a4bfe7f98d94d8a2d7d970a29402a 100644 (file)
@@ -982,18 +982,36 @@ propagate_necessity (struct edge_list *el)
     }
 }
 
-/* Replace all uses of result of PHI by underlying variable and mark it
+/* Replace all uses of NAME by underlying variable and mark it
    for renaming.  */
 
 void
-mark_virtual_phi_result_for_renaming (gimple phi)
+mark_virtual_operand_for_renaming (tree name)
 {
   bool used = false;
   imm_use_iterator iter;
   use_operand_p use_p;
   gimple stmt;
-  tree result_ssa, result_var;
+  tree name_var;
+
+  name_var = SSA_NAME_VAR (name);
+  FOR_EACH_IMM_USE_STMT (stmt, iter, name)
+    {
+      FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+        SET_USE (use_p, name_var);
+      update_stmt (stmt);
+      used = true;
+    }
+  if (used)
+    mark_sym_for_renaming (name_var);
+}
 
+/* Replace all uses of result of PHI by underlying variable and mark it
+   for renaming.  */
+
+void
+mark_virtual_phi_result_for_renaming (gimple phi)
+{
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file, "Marking result for renaming : ");
@@ -1001,19 +1019,10 @@ mark_virtual_phi_result_for_renaming (gimple phi)
       fprintf (dump_file, "\n");
     }
 
-  result_ssa = gimple_phi_result (phi);
-  result_var = SSA_NAME_VAR (result_ssa);
-  FOR_EACH_IMM_USE_STMT (stmt, iter, result_ssa)
-    {
-      FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
-        SET_USE (use_p, result_var);
-      update_stmt (stmt);
-      used = true;
-    }
-  if (used)
-    mark_sym_for_renaming (result_var);
+  mark_virtual_operand_for_renaming (gimple_phi_result (phi));
 }
 
+
 /* Remove dead PHI nodes from block BB.  */
 
 static bool
index 611a30f23a47c8a954eddb2c5ec7c1530cf08b2f..529388c1b220333fec612c7f6fe2e6b058b19469 100644 (file)
@@ -773,18 +773,56 @@ same_succ_flush_bbs (bitmap bbs)
     }
 }
 
+/* Release the last vdef in BB, either normal or phi result.  */
+
+static void
+release_last_vdef (basic_block bb)
+{
+  gimple_stmt_iterator i;
+
+  for (i = gsi_last_bb (bb); !gsi_end_p (i); gsi_prev_nondebug (&i))
+    {
+      gimple stmt = gsi_stmt (i);
+      if (gimple_vdef (stmt) == NULL_TREE)
+       continue;
+
+      mark_virtual_operand_for_renaming (gimple_vdef (stmt));
+      return;
+    }
+
+  for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
+    {
+      gimple phi = gsi_stmt (i);
+      tree res = gimple_phi_result (phi);
+
+      if (is_gimple_reg (res))
+       continue;
+
+      mark_virtual_phi_result_for_renaming (phi);
+      return;
+    }
+  
+}
+
 /* Delete all deleted_bbs.  */
 
 static void
-purge_bbs (void)
+purge_bbs (bool update_vops)
 {
   unsigned int i;
   bitmap_iterator bi;
+  basic_block bb;
 
   same_succ_flush_bbs (deleted_bbs);
 
   EXECUTE_IF_SET_IN_BITMAP (deleted_bbs, 0, i, bi)
-    delete_basic_block (BASIC_BLOCK (i));
+    {
+      bb = BASIC_BLOCK (i);
+      if (!update_vops)
+       release_last_vdef (bb);
+
+      delete_basic_block (bb);
+    }
 
   bitmap_and_compl_into (deleted_bb_preds, deleted_bbs);
   bitmap_clear (deleted_bbs);
@@ -1665,7 +1703,7 @@ tail_merge_optimize (unsigned int todo)
        break;
 
       free_dominance_info (CDI_DOMINATORS);
-      purge_bbs ();
+      purge_bbs (update_vops);
 
       if (iteration_nr == max_iterations)
        break;