OSDN Git Service

PR debug/40012
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-propagate.c
index 76aec2a..a3a87cb 100644 (file)
@@ -449,10 +449,14 @@ simulate_block (basic_block block)
          simulate_stmt (stmt);
        }
 
-      /* We can not predict when abnormal edges will be executed, so
+      /* We can not predict when abnormal and EH edges will be executed, so
         once a block is considered executable, we consider any
         outgoing abnormal edges as executable.
 
+        TODO: This is not exactly true.  Simplifying statement might
+        prove it non-throwing and also computed goto can be handled
+        when destination is known.
+
         At the same time, if this block has only one successor that is
         reached by non-abnormal edges, then add that successor to the
         worklist.  */
@@ -460,7 +464,7 @@ simulate_block (basic_block block)
       normal_edge = NULL;
       FOR_EACH_EDGE (e, ei, block->succs)
        {
-         if (e->flags & EDGE_ABNORMAL)
+         if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
            add_control_edge (e);
          else
            {
@@ -483,7 +487,6 @@ ssa_prop_init (void)
   edge e;
   edge_iterator ei;
   basic_block bb;
-  size_t i;
 
   /* Worklists of SSA edges.  */
   interesting_ssa_edges = VEC_alloc (gimple, gc, 20);
@@ -501,11 +504,6 @@ ssa_prop_init (void)
   cfg_blocks = VEC_alloc (basic_block, heap, 20);
   VEC_safe_grow (basic_block, heap, cfg_blocks, 20);
 
-  /* Initialize the values for every SSA_NAME.  */
-  for (i = 1; i < num_ssa_names; i++)
-    if (ssa_name (i))
-      SSA_NAME_VALUE (ssa_name (i)) = NULL_TREE;
-
   /* Initially assume that every edge in the CFG is not executable.
      (including the edges coming out of ENTRY_BLOCK_PTR).  */
   FOR_ALL_BB (bb)
@@ -1111,9 +1109,6 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
              continue;
            }
 
-         /* Record the state of the statement before replacements.  */
-         push_stmt_changes (gsi_stmt_ptr (&i));
-
          /* Replace the statement with its folded version and mark it
             folded.  */
          did_replace = false;
@@ -1174,14 +1169,9 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p)
               }
 
              /* Determine what needs to be done to update the SSA form.  */
-             pop_stmt_changes (gsi_stmt_ptr (&i));
+             update_stmt (stmt);
              something_changed = true;
            }
-         else
-           {
-             /* The statement was not modified, discard the change buffer.  */
-             discard_stmt_changes (gsi_stmt_ptr (&i));
-           }
 
          if (dump_file && (dump_flags & TDF_DETAILS))
            {