While working on related code I noticed that we can keep
the vops up todate so rename ssa does not need to do anything here.
This manually updates the 2 inserted statements, the load on the edge
and the store in the join bb. This should be a small compile
time optimization.
Boostrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-ssa-phiopt.cc (cond_store_replacement): Update
the vuse on the new load and the vuse/vdef on the new
store.
Signed-off-by: Andrew Pinski <[email protected]>
---
gcc/tree-ssa-phiopt.cc | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index ebdff20b69b..b18e5aa9c06 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -3167,9 +3167,12 @@ cond_store_replacement (basic_block middle_bb,
basic_block join_bb, edge e0,
/* 2) Insert a load from the memory of the store to the temporary
on the edge which did not contain the store. */
+ gphi *vphi = get_virtual_phi (join_bb);
name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
new_stmt = gimple_build_assign (name, lhs);
gimple_set_location (new_stmt, locus);
+ /* Set the vuse for the new load. */
+ gimple_set_vuse (new_stmt, gimple_phi_arg_def (vphi, e1->dest_idx));
lhs = unshare_expr (lhs);
{
/* Set the no-warning bit on the rhs of the load to avoid uninit
@@ -3189,6 +3192,15 @@ cond_store_replacement (basic_block middle_bb,
basic_block join_bb, edge e0,
new_stmt = gimple_build_assign (lhs, gimple_phi_result (newphi));
+ /* Update the vdef for the new store statement. */
+ tree newvphilhs = make_ssa_name (gimple_vop (cfun));
+ tree vdef = gimple_phi_result (vphi);
+ gimple_set_vuse (new_stmt, newvphilhs);
+ gimple_set_vdef (new_stmt, vdef);
+ gimple_phi_set_result (vphi, newvphilhs);
+ SSA_NAME_DEF_STMT (vdef) = new_stmt;
+ update_stmt (vphi);
+
/* 4) Insert that PHI node. */
gsi = gsi_after_labels (join_bb);
gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT);
--
2.43.0