]> gcc.gnu.org Git - gcc.git/commitdiff
tree-cfg.c (bsi_insert_before, [...]): Call modify_stmt after linking stmt into the...
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 10 Aug 2004 18:31:26 +0000 (18:31 +0000)
committerAndrew Macleod <amacleod@gcc.gnu.org>
Tue, 10 Aug 2004 18:31:26 +0000 (18:31 +0000)
2004-08-10  Andrew MacLeod  <amacleod@redhat.com>

* tree-cfg.c (bsi_insert_before, bsi_insert_after): Call modify_stmt
after linking stmt into the program.
(bsi_remove): Don't call modify_stmt.
* tree-complex.c (update_complex_assignment,
expand_complex_comparison): Call modify_stmt after changing the stmt.
* tree-outof-ssa.c (rewrite_trees): Call modify_stmt only if not
removing the stmt.
* tree-ssa-ccp.c (substitute_and_fold): Call modify_stmt after changing
the stmt, and only if needed.
* tree-ssa-dom.c (thread_across_edge): Pass no annotation for a dummy
expression.
(simplify_rhs_and_lookup_avail_expr): Don't take an annotation param.
(simplify_cond_and_lookup_avail_expr): Use modify_stmt.
(simplify_switch_and_lookup_avail_expr): Don't take an annotation param.
(eliminate_redundant_computations): Don't pass an annotation. Call
modify_stmt rather than setting the annotation directly.
(record_equivalences_from_stmt): Remove unused local 'j'.
(cprop_operand): Take a stmt rather than an annotation as a parameter.
Call modify_stmt.
(cprop_into_stmt): Pass stmt rather than annotation.
(update_rhs_and_lookup_avail_expr): Call modify_stmt.
* tree-ssa-loop-im.c (schedule_sm): Call get_stmt_ann rather than
modify_stmt.
* tree-ssa.c (propagate_into_addr): Dont call modify_stmt.

From-SVN: r85765

gcc/ChangeLog
gcc/tree-cfg.c
gcc/tree-complex.c
gcc/tree-outof-ssa.c
gcc/tree-ssa-ccp.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-loop-im.c
gcc/tree-ssa.c

index fc95cf250c54ab2a87c76d31f3f4c9958f74228c..e8d1398d3f877262a7c3b436d7f2db0d19f0e2f8 100644 (file)
@@ -1,3 +1,30 @@
+2004-08-10  Andrew MacLeod  <amacleod@redhat.com>
+
+       * tree-cfg.c (bsi_insert_before, bsi_insert_after): Call modify_stmt
+       after linking stmt into the program.
+       (bsi_remove): Don't call modify_stmt.
+       * tree-complex.c (update_complex_assignment, 
+       expand_complex_comparison): Call modify_stmt after changing the stmt.
+       * tree-outof-ssa.c (rewrite_trees): Call modify_stmt only if not 
+       removing the stmt.
+       * tree-ssa-ccp.c (substitute_and_fold): Call modify_stmt after changing
+       the stmt, and only if needed.
+       * tree-ssa-dom.c (thread_across_edge): Pass no annotation for a dummy
+       expression.
+       (simplify_rhs_and_lookup_avail_expr): Don't take an annotation param.
+       (simplify_cond_and_lookup_avail_expr): Use modify_stmt.
+       (simplify_switch_and_lookup_avail_expr): Don't take an annotation param.
+       (eliminate_redundant_computations): Don't pass an annotation. Call 
+       modify_stmt rather than setting the annotation directly.
+       (record_equivalences_from_stmt): Remove unused local 'j'.
+       (cprop_operand): Take a stmt rather than an annotation as a parameter.
+       Call modify_stmt.
+       (cprop_into_stmt): Pass stmt rather than annotation.
+       (update_rhs_and_lookup_avail_expr): Call modify_stmt.
+       * tree-ssa-loop-im.c (schedule_sm): Call get_stmt_ann rather than 
+       modify_stmt.
+       * tree-ssa.c (propagate_into_addr): Dont call modify_stmt.
+
 2004-08-10  Jason Merrill  <jason@redhat.com>
 
        PR middle-end/16948
index c9bc37ce6b9f87800142578cb8c694c9174c6092..33c8325041b108014eeb8fcf3388b3fc0bc4a876 100644 (file)
@@ -2814,8 +2814,8 @@ void
 bsi_insert_before (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
 {
   set_bb_for_stmt (t, i->bb);
-  modify_stmt (t);
   tsi_link_before (&i->tsi, t, m);
+  modify_stmt (t);
 }
 
 
@@ -2827,8 +2827,8 @@ void
 bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
 {
   set_bb_for_stmt (t, i->bb);
-  modify_stmt (t);
   tsi_link_after (&i->tsi, t, m);
+  modify_stmt (t);
 }
 
 
@@ -2840,7 +2840,6 @@ bsi_remove (block_stmt_iterator *i)
 {
   tree t = bsi_stmt (*i);
   set_bb_for_stmt (t, NULL);
-  modify_stmt (t);
   tsi_delink (&i->tsi);
 }
 
index a960f92c42427b76bfa17426a978bffa9a6a103b..54ea8197df180f5946db932a26b4793f85185128 100644 (file)
@@ -78,12 +78,12 @@ update_complex_assignment (block_stmt_iterator *bsi, tree r, tree i)
   tree stmt = bsi_stmt (*bsi);
   tree type;
 
-  modify_stmt (stmt);
   if (TREE_CODE (stmt) == RETURN_EXPR)
     stmt = TREE_OPERAND (stmt, 0);
   
   type = TREE_TYPE (TREE_OPERAND (stmt, 1));
   TREE_OPERAND (stmt, 1) = build (COMPLEX_EXPR, type, r, i);
+  modify_stmt (stmt);
 }
 
 /* Expand complex addition to scalars:
@@ -326,7 +326,7 @@ static void
 expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
                           tree br, tree bi, enum tree_code code)
 {
-  tree cr, ci, cc, stmt, type;
+  tree cr, ci, cc, stmt, expr, type;
 
   cr = gimplify_build2 (bsi, code, boolean_type_node, ar, br);
   ci = gimplify_build2 (bsi, code, boolean_type_node, ai, bi);
@@ -334,17 +334,16 @@ expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
                        (code == EQ_EXPR ? TRUTH_AND_EXPR : TRUTH_OR_EXPR),
                        boolean_type_node, cr, ci);
 
-  stmt = bsi_stmt (*bsi);
-  modify_stmt (stmt);
+  stmt = expr = bsi_stmt (*bsi);
 
   switch (TREE_CODE (stmt))
     {
     case RETURN_EXPR:
-      stmt = TREE_OPERAND (stmt, 0);
+      expr = TREE_OPERAND (stmt, 0);
       /* FALLTHRU */
     case MODIFY_EXPR:
-      type = TREE_TYPE (TREE_OPERAND (stmt, 1));
-      TREE_OPERAND (stmt, 1) = fold_convert (type, cc);
+      type = TREE_TYPE (TREE_OPERAND (expr, 1));
+      TREE_OPERAND (expr, 1) = fold_convert (type, cc);
       break;
     case COND_EXPR:
       TREE_OPERAND (stmt, 0) = cc;
@@ -352,6 +351,8 @@ expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
     default:
       abort ();
     }
+
+  modify_stmt (stmt);
 }
 
 /* Process one statement.  If we identify a complex operation, expand it.  */
index 33a927e14aeaae7fe279b5400756c9cfb4005a3d..5b1e2a8fc1e4225012a4a9ef25c4fcbe6da5b376 100644 (file)
@@ -1935,7 +1935,7 @@ rewrite_trees (var_map map, tree *values)
                      && (DEF_FROM_PTR (def_p) == USE_OP (uses, 0)))
                    remove = 1;
                }
-             if (changed)
+             if (changed & !remove)
                modify_stmt (stmt);
            }
 
index f883e373cc4911c2ecc5c7bbe22b764a75b1bcb6..e2d3bbf180af0eff5adff16c8fcc73855f849c65 100644 (file)
@@ -427,7 +427,6 @@ substitute_and_fold (void)
            {
              bool changed = fold_stmt (bsi_stmt_ptr (i));
              stmt = bsi_stmt(i);
-             modify_stmt (stmt);
              /* If we folded a builtin function, we'll likely
                 need to rename VDEFs.  */
              if (replaced_address || changed)
@@ -436,6 +435,8 @@ substitute_and_fold (void)
                  if (maybe_clean_eh_stmt (stmt))
                    tree_purge_dead_eh_edges (bb);
                }
+             else
+               modify_stmt (stmt);
            }
 
          if (dump_file && (dump_flags & TDF_DETAILS))
index 26df9ed75913dc1737e41f3ab1fe21d7ff4a9903..c089cf1b590b34dde72786ed2dd84b5d9f981b56 100644 (file)
@@ -223,14 +223,12 @@ static void record_cond (tree, tree, varray_type *);
 static void record_dominating_conditions (tree, varray_type *);
 static void record_const_or_copy (tree, tree, varray_type *);
 static void record_equality (tree, tree, varray_type *);
-static tree update_rhs_and_lookup_avail_expr (tree, tree, varray_type *,
-                                             stmt_ann_t, bool);
+static tree update_rhs_and_lookup_avail_expr (tree, tree, varray_type *, bool);
 static tree simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *,
-                                               tree, stmt_ann_t, int);
+                                               tree, int);
 static tree simplify_cond_and_lookup_avail_expr (tree, varray_type *,
                                                 stmt_ann_t, int);
-static tree simplify_switch_and_lookup_avail_expr (tree, varray_type *,
-                                                  stmt_ann_t, int);
+static tree simplify_switch_and_lookup_avail_expr (tree, varray_type *, int);
 static tree find_equivalent_equality_comparison (tree);
 static void record_range (tree, basic_block, varray_type *);
 static bool extract_range_from_cond (tree, tree *, tree *, int *);
@@ -652,10 +650,9 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
            cached_lhs = lookup_avail_expr (dummy_cond, NULL, false);
          if (!cached_lhs || ! is_gimple_min_invariant (cached_lhs))
            {
-             stmt_ann_t ann = get_stmt_ann (dummy_cond);
              cached_lhs = simplify_cond_and_lookup_avail_expr (dummy_cond,
                                                                NULL,
-                                                               ann,
+                                                               NULL,
                                                                false);
            }
        }
@@ -1628,9 +1625,7 @@ record_equality (tree x, tree y, varray_type *block_const_and_copies_p)
 
 static tree
 simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
-                                   tree stmt,
-                                   stmt_ann_t ann,
-                                   int insert)
+                                   tree stmt, int insert)
 {
   tree rhs = TREE_OPERAND (stmt, 1);
   enum tree_code rhs_code = TREE_CODE (rhs);
@@ -1663,7 +1658,6 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
            result = update_rhs_and_lookup_avail_expr (stmt,
                                                       rhs_def_operand,
                                                       &bd->avail_exprs,
-                                                      ann,
                                                       insert);
        }
     }
@@ -1748,7 +1742,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
                          && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
                          && is_gimple_val (TREE_OPERAND (t, 1))))
                    result = update_rhs_and_lookup_avail_expr
-                     (stmt, t, &bd->avail_exprs, ann, insert);
+                     (stmt, t, &bd->avail_exprs, insert);
                }
            }
        }
@@ -1808,8 +1802,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
                                          op1, integer_one_node)));
 
          result = update_rhs_and_lookup_avail_expr (stmt, t,
-                                                    &bd->avail_exprs,
-                                                    ann, insert);
+                                                    &bd->avail_exprs, insert);
        }
     }
 
@@ -1880,8 +1873,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
            t = op;
 
          result = update_rhs_and_lookup_avail_expr (stmt, t,
-                                                    &bd->avail_exprs,
-                                                    ann, insert);
+                                                    &bd->avail_exprs, insert);
        }
     }
 
@@ -1893,8 +1885,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
 
       if (t)
         result = update_rhs_and_lookup_avail_expr (stmt, t,
-                                                  &bd->avail_exprs,
-                                                  ann, insert);
+                                                  &bd->avail_exprs, insert);
     }
 
   return result;
@@ -2001,7 +1992,11 @@ simplify_cond_and_lookup_avail_expr (tree stmt,
                  /* Update the statement to use the new equivalent
                     condition.  */
                  COND_EXPR_COND (stmt) = new_cond;
-                 ann->modified = 1;
+
+                 /* If this is not a real stmt, ann will be NULL and we
+                    avoid processing the operands.  */
+                 if (ann)
+                   modify_stmt (stmt);
 
                  /* Lookup the condition and return its known value if it
                     exists.  */
@@ -2197,7 +2192,6 @@ simplify_cond_and_lookup_avail_expr (tree stmt,
 static tree
 simplify_switch_and_lookup_avail_expr (tree stmt,
                                       varray_type *block_avail_exprs_p,
-                                      stmt_ann_t ann,
                                       int insert)
 {
   tree cond = SWITCH_COND (stmt);
@@ -2243,7 +2237,7 @@ simplify_switch_and_lookup_avail_expr (tree stmt,
              if (!fail)
                {
                  SWITCH_COND (stmt) = def;
-                 ann->modified = 1;
+                 modify_stmt (stmt);
 
                  return lookup_avail_expr (stmt, block_avail_exprs_p, insert);
                }
@@ -2404,7 +2398,6 @@ eliminate_redundant_computations (struct dom_walk_data *walk_data,
   if (! cached_lhs && TREE_CODE (stmt) == MODIFY_EXPR)
     cached_lhs = simplify_rhs_and_lookup_avail_expr (walk_data,
                                                     stmt,
-                                                    ann,
                                                     insert);
   /* Similarly if this is a COND_EXPR and we did not find its
      expression in the hash table, simplify the condition and
@@ -2418,7 +2411,6 @@ eliminate_redundant_computations (struct dom_walk_data *walk_data,
   else if (!cached_lhs && TREE_CODE (stmt) == SWITCH_EXPR)
     cached_lhs = simplify_switch_and_lookup_avail_expr (stmt,
                                                        &bd->avail_exprs,
-                                                       ann,
                                                        insert);
 
   opt_stats.num_exprs_considered++;
@@ -2465,7 +2457,7 @@ eliminate_redundant_computations (struct dom_walk_data *walk_data,
        retval = true;
 
       propagate_tree_value (expr_p, cached_lhs);
-      ann->modified = 1;
+      modify_stmt (stmt);
     }
   return retval;
 }
@@ -2642,7 +2634,7 @@ record_equivalences_from_stmt (tree stmt,
    CONST_AND_COPIES.  */
 
 static bool
-cprop_operand (stmt_ann_t ann, use_operand_p op_p, varray_type const_and_copies)
+cprop_operand (tree stmt, use_operand_p op_p, varray_type const_and_copies)
 {
   bool may_have_exposed_new_symbols = false;
   tree val;
@@ -2721,7 +2713,7 @@ cprop_operand (stmt_ann_t ann, use_operand_p op_p, varray_type const_and_copies)
       /* And note that we modified this statement.  This is now
         safe, even if we changed virtual operands since we will
         rescan the statement and rewrite its operands again.  */
-      ann->modified = 1;
+      modify_stmt (stmt);
     }
   return may_have_exposed_new_symbols;
 }
@@ -2749,7 +2741,7 @@ cprop_into_stmt (tree stmt, varray_type const_and_copies)
       use_operand_p op_p = USE_OP_PTR (uses, i);
       if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
        may_have_exposed_new_symbols
-         |= cprop_operand (ann, op_p, const_and_copies);
+         |= cprop_operand (stmt, op_p, const_and_copies);
     }
 
   vuses = VUSE_OPS (ann);
@@ -2759,7 +2751,7 @@ cprop_into_stmt (tree stmt, varray_type const_and_copies)
       use_operand_p op_p = VUSE_OP_PTR (vuses, i);
       if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
        may_have_exposed_new_symbols
-         |= cprop_operand (ann, op_p, const_and_copies);
+         |= cprop_operand (stmt, op_p, const_and_copies);
     }
 
   v_may_defs = V_MAY_DEF_OPS (ann);
@@ -2769,7 +2761,7 @@ cprop_into_stmt (tree stmt, varray_type const_and_copies)
       use_operand_p op_p = V_MAY_DEF_OP_PTR (v_may_defs, i);
       if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
        may_have_exposed_new_symbols
-         |= cprop_operand (ann, op_p, const_and_copies);
+         |= cprop_operand (stmt, op_p, const_and_copies);
     }
   return may_have_exposed_new_symbols;
 }
@@ -2936,7 +2928,6 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
 static tree
 update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs, 
                                  varray_type *block_avail_exprs_p,
-                                 stmt_ann_t ann,
                                  bool insert)
 {
   tree cached_lhs = NULL;
@@ -2982,7 +2973,7 @@ update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs,
 
   /* And make sure we record the fact that we modified this
      statement.  */
-  ann->modified = 1;
+  modify_stmt (stmt);
 
   return cached_lhs;
 }
index 465442615cbcbebb49daf75440b50343fb043341..3d2d1c6a7a9933e655fe4e985ce21eecbbe17a1b 100644 (file)
@@ -1007,8 +1007,7 @@ schedule_sm (struct loop *loop, edge *exits, unsigned n_exits, tree ref,
 
   /* Emit the load & stores.  */
   load = build (MODIFY_EXPR, void_type_node, tmp_var, ref);
-  modify_stmt (load);
-  stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
+  get_stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
   LIM_DATA (load)->max_loop = loop;
   LIM_DATA (load)->tgt_loop = loop;
 
index dd79b5a7d9f26866bbb5bc61c59a7abc2eef51f6..eb6f9676617370d7ae1222f0c426b94d93dbda7b 100644 (file)
@@ -925,7 +925,6 @@ propagate_into_addr (tree stmt, tree var, tree *x, tree repl)
       || TREE_OPERAND (*x, 0) != var)
     return;
 
-  modify_stmt (stmt);
   if (TREE_TYPE (*x) == TREE_TYPE (addr_var))
     {
       *x = addr_var;
@@ -933,6 +932,7 @@ propagate_into_addr (tree stmt, tree var, tree *x, tree repl)
       return;
     }
 
+
   /* Frontends sometimes produce expressions like *&a instead of a[0].
      Create a temporary variable to handle this case.  */
   ass_stmt = build2 (MODIFY_EXPR, void_type_node, NULL_TREE, repl);
This page took 0.095885 seconds and 5 git commands to generate.