aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/tree-ssa-phiprop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/tree-ssa-phiprop.c')
-rw-r--r--gcc-4.8/gcc/tree-ssa-phiprop.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/tree-ssa-phiprop.c b/gcc-4.8/gcc/tree-ssa-phiprop.c
index 4da181487..36b47d7f0 100644
--- a/gcc-4.8/gcc/tree-ssa-phiprop.c
+++ b/gcc-4.8/gcc/tree-ssa-phiprop.c
@@ -307,6 +307,12 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
gimple def_stmt;
tree vuse;
+ /* Only replace loads in blocks that post-dominate the PHI node. That
+ makes sure we don't end up speculating loads. */
+ if (!dominated_by_p (CDI_POST_DOMINATORS,
+ bb, gimple_bb (use_stmt)))
+ continue;
+
/* Check whether this is a load of *ptr. */
if (!(is_gimple_assign (use_stmt)
&& TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
@@ -378,6 +384,7 @@ tree_ssa_phiprop (void)
size_t n;
calculate_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_POST_DOMINATORS);
n = num_ssa_names;
phivn = XCNEWVEC (struct phiprop_d, n);
@@ -395,6 +402,8 @@ tree_ssa_phiprop (void)
bbs.release ();
free (phivn);
+ free_dominance_info (CDI_POST_DOMINATORS);
+
return 0;
}