diff options
author | Seongbae Park <seongbae.park@gmail.com> | 2008-05-28 20:15:10 +0000 |
---|---|---|
committer | Seongbae Park <spark@gcc.gnu.org> | 2008-05-28 20:15:10 +0000 |
commit | b608a1bc71edb6b778407dd9bfdf0cbd6bcb4c1b (patch) | |
tree | eec1f0a98236b0cc50a93f03ae95201e815b992a /gcc/tree-ssa-propagate.c | |
parent | 77da4248a98f179e1a5be88050ea7fd294e5618e (diff) | |
download | gcc-b608a1bc71edb6b778407dd9bfdf0cbd6bcb4c1b.zip gcc-b608a1bc71edb6b778407dd9bfdf0cbd6bcb4c1b.tar.gz gcc-b608a1bc71edb6b778407dd9bfdf0cbd6bcb4c1b.tar.bz2 |
tree-ssa-propagate.c (set_rhs): Preserve the histogram and the eh region information.
2008-05-28 Seongbae Park <seongbae.park@gmail.com>
* tree-ssa-propagate.c (set_rhs): Preserve the histogram
and the eh region information.
* value-prof.c (gimple_move_stmt_histograms): New function.
* value-prof.h (gimple_move_stmt_histograms): New function declaration.
From-SVN: r136124
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index ae7fe84..b0371805 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -40,6 +40,7 @@ #include "langhooks.h" #include "varray.h" #include "vec.h" +#include "value-prof.h" /* This file implements a generic value propagation engine based on the same propagation used by the SSA-CCP algorithm [1]. @@ -680,9 +681,10 @@ bool set_rhs (tree *stmt_p, tree expr) { tree stmt = *stmt_p, op; - stmt_ann_t ann; + tree new_stmt; tree var; ssa_op_iter iter; + int eh_region; if (!valid_gimple_expression_p (expr)) return false; @@ -733,9 +735,22 @@ set_rhs (tree *stmt_p, tree expr) default: /* Replace the whole statement with EXPR. If EXPR has no side effects, then replace *STMT_P with an empty statement. */ - ann = stmt_ann (stmt); - *stmt_p = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt (); - (*stmt_p)->base.ann = (tree_ann_t) ann; + new_stmt = TREE_SIDE_EFFECTS (expr) ? expr : build_empty_stmt (); + *stmt_p = new_stmt; + + /* Preserve the annotation, the histograms and the EH region information + associated with the original statement. The EH information + needs to be preserved only if the new statement still can throw. */ + new_stmt->base.ann = (tree_ann_t) stmt_ann (stmt); + gimple_move_stmt_histograms (cfun, new_stmt, stmt); + if (tree_could_throw_p (new_stmt)) + { + eh_region = lookup_stmt_eh_region (stmt); + /* We couldn't possibly turn a nothrow into a throw statement. */ + gcc_assert (eh_region >= 0); + remove_stmt_from_eh_region (stmt); + add_stmt_to_eh_region (new_stmt, eh_region); + } if (gimple_in_ssa_p (cfun) && TREE_SIDE_EFFECTS (expr)) |