This corresponds to: [PATCH 53/89] More gimple_phi https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01200.html from the original 89-patch kit
That earlier patch was approved by Jeff: > Ok once prerequisites have gone in. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00812.html gcc/ * gimple.h (gimple_phi_set_result): Require a gimple_phi rather than a plain gimple. (gimple_phi_set_arg): Likewise. * tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked cast to gimple_phi. * tree-sra.c (replace_removed_params_ssa_names): Add a checked cast to gimple_phi. --- gcc/ChangeLog.gimple-classes | 14 ++++++++++++++ gcc/gimple.h | 18 ++++++++---------- gcc/tree-outof-ssa.c | 4 ++-- gcc/tree-sra.c | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 4a78ca0..8662070 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,19 @@ 2014-10-24 David Malcolm <dmalc...@redhat.com> + More gimple_phi + + * gimple.h (gimple_phi_set_result): Require a gimple_phi rather + than a plain gimple. + (gimple_phi_set_arg): Likewise. + + * tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked + cast to gimple_phi. + + * tree-sra.c (replace_removed_params_ssa_names): Add a checked + cast to gimple_phi. + +2014-10-24 David Malcolm <dmalc...@redhat.com> + Make gimple_phi_arg_edge require a gimple_phi * gimple.h (gimple_phi_arg_edge): Require a gimple_phi rather diff --git a/gcc/gimple.h b/gcc/gimple.h index 96d9245..eff62d2 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3909,15 +3909,14 @@ gimple_phi_result_ptr (gimple gs) return &phi_stmt->result; } -/* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */ +/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */ static inline void -gimple_phi_set_result (gimple gs, tree result) +gimple_phi_set_result (gimple_phi phi, tree result) { - gimple_phi phi_stmt = as_a <gimple_phi> (gs); - phi_stmt->result = result; + phi->result = result; if (result && TREE_CODE (result) == SSA_NAME) - SSA_NAME_DEF_STMT (result) = gs; + SSA_NAME_DEF_STMT (result) = phi; } @@ -3933,14 +3932,13 @@ gimple_phi_arg (gimple gs, unsigned index) } /* Set PHIARG to be the argument corresponding to incoming edge INDEX - for GIMPLE_PHI GS. */ + for GIMPLE_PHI PHI. */ static inline void -gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg) +gimple_phi_set_arg (gimple_phi phi, unsigned index, struct phi_arg_d * phiarg) { - gimple_phi phi_stmt = as_a <gimple_phi> (gs); - gcc_gimple_checking_assert (index <= phi_stmt->nargs); - phi_stmt->args[index] = *phiarg; + gcc_gimple_checking_assert (index <= phi->nargs); + phi->args[index] = *phiarg; } /* Return the PHI nodes for basic block BB, or NULL if there are no diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 432c2b2..68814e3 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -788,7 +788,7 @@ eliminate_phi (edge e, elim_graph g) check to see if this allows another PHI node to be removed. */ static void -remove_gimple_phi_args (gimple phi) +remove_gimple_phi_args (gimple_phi phi) { use_operand_p arg_p; ssa_op_iter iter; @@ -816,7 +816,7 @@ remove_gimple_phi_args (gimple phi) /* Also remove the def if it is a PHI node. */ if (gimple_code (stmt) == GIMPLE_PHI) { - remove_gimple_phi_args (stmt); + remove_gimple_phi_args (as_a <gimple_phi> (stmt)); gsi = gsi_for_stmt (stmt); remove_phi_node (&gsi, true); } diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 3cdd100..9f67f6d 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4556,7 +4556,7 @@ replace_removed_params_ssa_names (gimple stmt, else if (is_gimple_call (stmt)) gimple_call_set_lhs (stmt, name); else - gimple_phi_set_result (stmt, name); + gimple_phi_set_result (as_a <gimple_phi> (stmt), name); replace_uses_by (lhs, name); release_ssa_name (lhs); -- 1.8.5.3