OSDN Git Service

2011-12-14 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Dec 2011 09:50:38 +0000 (09:50 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Dec 2011 09:50:38 +0000 (09:50 +0000)
* tree-cfg.c (replace_uses_by): Only mark blocks altered
that will make a difference.  Only recompute ADDR_EXPR
invariantness if it could possibly have changed.  Do so
before folding the statement.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182327 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-cfg.c

index 1cb1807..d792244 100644 (file)
@@ -1,3 +1,10 @@
+2011-12-14  Richard Guenther  <rguenther@suse.de>
+
+       * tree-cfg.c (replace_uses_by): Only mark blocks altered
+       that will make a difference.  Only recompute ADDR_EXPR
+       invariantness if it could possibly have changed.  Do so
+       before folding the statement.
+
 2011-12-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * lto-streamer-out.c (write_symbol): Use proper 64-bit host type.
 2011-12-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * lto-streamer-out.c (write_symbol): Use proper 64-bit host type.
index db10daf..3d1b775 100644 (file)
@@ -1592,7 +1592,7 @@ replace_uses_by (tree name, tree val)
                  /* This can only occur for virtual operands, since
                     for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
                     would prevent replacement.  */
                  /* This can only occur for virtual operands, since
                     for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
                     would prevent replacement.  */
-                 gcc_assert (!is_gimple_reg (name));
+                 gcc_checking_assert (!is_gimple_reg (name));
                  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val) = 1;
                }
            }
                  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val) = 1;
                }
            }
@@ -1604,28 +1604,37 @@ replace_uses_by (tree name, tree val)
          gimple orig_stmt = stmt;
          size_t i;
 
          gimple orig_stmt = stmt;
          size_t i;
 
-         fold_stmt (&gsi);
-         stmt = gsi_stmt (gsi);
-         if (cfgcleanup_altered_bbs && !is_gimple_debug (stmt))
+         /* Mark the block if we changed the last stmt in it.  */
+         if (cfgcleanup_altered_bbs
+             && stmt_ends_bb_p (stmt))
            bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
 
            bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
 
-         /* FIXME.  This should go in update_stmt.  */
-         for (i = 0; i < gimple_num_ops (stmt); i++)
+         /* FIXME.  It shouldn't be required to keep TREE_CONSTANT
+            on ADDR_EXPRs up-to-date on GIMPLE.  Propagation will
+            only change sth from non-invariant to invariant, and only
+            when propagating integer constants.  */
+         if (TREE_CODE (val) == INTEGER_CST)
+           for (i = 0; i < gimple_num_ops (stmt); i++)
+             {
+               tree op = gimple_op (stmt, i);
+               /* Operands may be empty here.  For example, the labels
+                  of a GIMPLE_COND are nulled out following the creation
+                  of the corresponding CFG edges.  */
+               if (op && TREE_CODE (op) == ADDR_EXPR)
+                 recompute_tree_invariant_for_addr_expr (op);
+             }
+
+         if (fold_stmt (&gsi))
            {
            {
-             tree op = gimple_op (stmt, i);
-              /* Operands may be empty here.  For example, the labels
-                 of a GIMPLE_COND are nulled out following the creation
-                 of the corresponding CFG edges.  */
-             if (op && TREE_CODE (op) == ADDR_EXPR)
-               recompute_tree_invariant_for_addr_expr (op);
+             stmt = gsi_stmt (gsi);
+             maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
            }
 
            }
 
-         maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
          update_stmt (stmt);
        }
     }
 
          update_stmt (stmt);
        }
     }
 
-  gcc_assert (has_zero_uses (name));
+  gcc_checking_assert (has_zero_uses (name));
 
   /* Also update the trees stored in loop structures.  */
   if (current_loops)
 
   /* Also update the trees stored in loop structures.  */
   if (current_loops)