diff options
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 46d8a2c..51a21c0 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1454,6 +1454,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, gimple newphi, new_stmt; gimple_stmt_iterator gsi; source_location locus; + tree block; /* Check if middle_bb contains of only one store. */ if (!assign @@ -1461,6 +1462,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, return false; locus = gimple_location (assign); + block = gimple_block (assign); lhs = gimple_assign_lhs (assign); rhs = gimple_assign_rhs1 (assign); if (TREE_CODE (lhs) != MEM_REF @@ -1494,14 +1496,15 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, name = make_ssa_name (condstoretemp, new_stmt); gimple_assign_set_lhs (new_stmt, name); gimple_set_location (new_stmt, locus); + gimple_set_block (new_stmt, block); gsi_insert_on_edge (e1, new_stmt); /* 4) Create a PHI node at the join block, with one argument holding the old RHS, and the other holding the temporary where we stored the old memory contents. */ newphi = create_phi_node (condstoretemp, join_bb); - add_phi_arg (newphi, rhs, e0, locus); - add_phi_arg (newphi, name, e1, locus); + add_phi_arg (newphi, rhs, e0, locus, block); + add_phi_arg (newphi, name, e1, locus, block); lhs = unshare_expr (lhs); new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi)); @@ -1528,6 +1531,7 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb, { tree lhs_base, lhs, then_rhs, else_rhs; source_location then_locus, else_locus; + tree then_block, else_block; gimple_stmt_iterator gsi; gimple newphi, new_stmt; @@ -1553,6 +1557,8 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb, else_rhs = gimple_assign_rhs1 (else_assign); then_locus = gimple_location (then_assign); else_locus = gimple_location (else_assign); + then_block = gimple_block (then_assign); + else_block = gimple_block (else_assign); /* Now we've checked the constraints, so do the transformation: 1) Remove the stores. */ @@ -1576,8 +1582,10 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb, holding the old RHS, and the other holding the temporary where we stored the old memory contents. */ newphi = create_phi_node (condstoretemp, join_bb); - add_phi_arg (newphi, then_rhs, EDGE_SUCC (then_bb, 0), then_locus); - add_phi_arg (newphi, else_rhs, EDGE_SUCC (else_bb, 0), else_locus); + add_phi_arg (newphi, then_rhs, EDGE_SUCC (then_bb, 0), then_locus, + then_block); + add_phi_arg (newphi, else_rhs, EDGE_SUCC (else_bb, 0), else_locus, + else_block); new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi)); |