From f73ce09148d16fbe1b3c2f58f964bbb14e200f69 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 17 Dec 2013 12:57:45 -0500 Subject: [PATCH] tree-parloops.c: Use gimple_phi in various places This corresponds to: [PATCH 46/89] tree-parloops.c: Use gimple_phi in various places https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01168.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/msg00819.html gcc/ * tree-parloops.c (reduction_info::keep_res): Strengthen field from plain gimple to gimple_phi. (transform_to_exit_first_loop): Strengthen locals "phi", "nphi" to gimple_phi. Eliminate early decl of gimple_stmt_iterator gsi in favor of more tightly scoped gimple_phi_iterators, and a final later decl as a gimple_stmt_iterator. --- gcc/ChangeLog.gimple-classes | 11 +++++++++++ gcc/tree-parloops.c | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index b0a8465ca59..b8d2f38946c 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,16 @@ 2014-10-24 David Malcolm + tree-parloops.c: Use gimple_phi in various places + + * tree-parloops.c (reduction_info::keep_res): Strengthen field + from plain gimple to gimple_phi. + (transform_to_exit_first_loop): Strengthen locals "phi", "nphi" + to gimple_phi. Eliminate early decl of gimple_stmt_iterator gsi + in favor of more tightly scoped gimple_phi_iterators, and a final + later decl as a gimple_stmt_iterator. + +2014-10-24 David Malcolm + Introduce gimple_omp_sections * coretypes.h (gimple_omp_sections): New typedef. diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index cd290a7d2b6..fbb74a9e0e4 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -192,7 +192,7 @@ struct reduction_info enum tree_code reduction_code;/* code for the reduction operation. */ unsigned reduc_version; /* SSA_NAME_VERSION of original reduc_phi result. */ - gimple keep_res; /* The PHI_RESULT of this phi is the resulting value + gimple_phi keep_res; /* The PHI_RESULT of this phi is the resulting value of the reduction variable when existing the loop. */ tree initial_value; /* The initial value of the reduction var before entering the loop. */ tree field; /* the name of the field in the parloop data structure intended for reduction. */ @@ -1498,8 +1498,8 @@ transform_to_exit_first_loop (struct loop *loop, bool ok; edge exit = single_dom_exit (loop), hpred; tree control, control_name, res, t; - gimple phi, nphi, cond_stmt, stmt, cond_nit; - gimple_stmt_iterator gsi; + gimple_phi phi, nphi; + gimple cond_stmt, stmt, cond_nit; tree nit_1; split_block_after_labels (loop->header); @@ -1512,9 +1512,11 @@ transform_to_exit_first_loop (struct loop *loop, /* Make sure that we have phi nodes on exit for all loop header phis (create_parallel_loop requires that). */ - for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gimple_phi_iterator gsi = gsi_start_phis (loop->header); + !gsi_end_p (gsi); + gsi_next (&gsi)) { - phi = gsi_stmt (gsi); + phi = gsi.phi (); res = PHI_RESULT (phi); t = copy_ssa_name (res, phi); SET_PHI_RESULT (phi, t); @@ -1545,9 +1547,10 @@ transform_to_exit_first_loop (struct loop *loop, out of the loop is the control variable. */ exit = single_dom_exit (loop); control_name = NULL_TREE; - for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); ) + for (gimple_phi_iterator gsi = gsi_start_phis (ex_bb); + !gsi_end_p (gsi); ) { - phi = gsi_stmt (gsi); + phi = gsi.phi (); res = PHI_RESULT (phi); if (virtual_operand_p (res)) { @@ -1582,7 +1585,7 @@ transform_to_exit_first_loop (struct loop *loop, /* Initialize the control variable to number of iterations according to the rhs of the exit condition. */ - gsi = gsi_after_labels (ex_bb); + gimple_stmt_iterator gsi = gsi_after_labels (ex_bb); cond_nit = last_stmt (exit->src); nit_1 = gimple_cond_rhs (cond_nit); nit_1 = force_gimple_operand_gsi (&gsi, -- 2.11.4.GIT