aboutsummaryrefslogtreecommitdiff
path: root/gcc/sese.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-12-08 23:01:40 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-12-08 23:01:40 +0000
commitfd66ea1a6f5ecd68c40d330e52e70e22cafec9d3 (patch)
treef1c5454ba13ad564e707268d461dc545286230f7 /gcc/sese.c
parent09c2d63aa4ea2fb3e90055ca521940df9f8fcb56 (diff)
downloadgcc-fd66ea1a6f5ecd68c40d330e52e70e22cafec9d3.zip
gcc-fd66ea1a6f5ecd68c40d330e52e70e22cafec9d3.tar.gz
gcc-fd66ea1a6f5ecd68c40d330e52e70e22cafec9d3.tar.bz2
Fix PR45230, PR45231, and PR45370: fold_stmt_inplace after replace_exp.
2010-12-08 Richard Guenther <rguenther@suse.de> Sebastian Pop <sebastian.pop@amd.com> PR tree-optimization/45230 PR tree-optimization/45231 PR tree-optimization/45370 * sese.c (rename_uses): Returns a bool. Call recompute_tree_invariant_for_addr_expr only on the RHS of a GIMPLE_ASSIGN. (graphite_copy_stmts_from_block): Call fold_stmt_inplace when rename_uses returns true. * tree-ssa-copy.c (replace_exp): Add a comment about calling fold_stmt_inplace after replace_exp. * gcc.dg/graphite/id-pr45230-1.c: New. * gcc.dg/graphite/id-pr45231.c: New. * gfortran.dg/graphite/id-pr45370.f90: New. Co-Authored-By: Sebastian Pop <sebastian.pop@amd.com> From-SVN: r167609
Diffstat (limited to 'gcc/sese.c')
-rw-r--r--gcc/sese.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/sese.c b/gcc/sese.c
index 65f8556..3bf6bea 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -470,14 +470,15 @@ set_rename (htab_t rename_map, tree old_name, tree expr)
substitution map RENAME_MAP, inserting the gimplification code at
GSI_TGT, for the translation REGION, with the original copied
statement in LOOP, and using the induction variable renaming map
- IV_MAP. */
+ IV_MAP. Returns true when something has been renamed. */
-static void
+static bool
rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
sese region, loop_p loop, VEC (tree, heap) *iv_map)
{
use_operand_p use_p;
ssa_op_iter op_iter;
+ bool changed = false;
if (is_gimple_debug (copy))
{
@@ -486,7 +487,7 @@ rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
else
gcc_unreachable ();
- return;
+ return false;
}
FOR_EACH_SSA_USE_OPERAND (use_p, copy, op_iter, SSA_OP_ALL_USES)
@@ -500,6 +501,7 @@ rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
|| SSA_NAME_IS_DEFAULT_DEF (old_name))
continue;
+ changed = true;
new_expr = get_rename (rename_map, old_name);
if (new_expr)
{
@@ -547,8 +549,8 @@ rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
gsi_insert_seq_before (gsi_tgt, stmts, GSI_SAME_STMT);
replace_exp (use_p, new_expr);
-
- if (TREE_CODE (new_expr) == INTEGER_CST)
+ if (TREE_CODE (new_expr) == INTEGER_CST
+ && is_gimple_assign (copy))
{
tree rhs = gimple_assign_rhs1 (copy);
@@ -558,6 +560,8 @@ rename_uses (gimple copy, htab_t rename_map, gimple_stmt_iterator *gsi_tgt,
set_rename (rename_map, old_name, new_expr);
}
+
+ return changed;
}
/* Duplicates the statements of basic block BB into basic block NEW_BB
@@ -611,7 +615,8 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
set_rename (rename_map, old_name, new_name);
}
- rename_uses (copy, rename_map, &gsi_tgt, region, loop, iv_map);
+ if (rename_uses (copy, rename_map, &gsi_tgt, region, loop, iv_map))
+ fold_stmt_inplace (copy);
update_stmt (copy);
}