From: Tom de Vries Date: Thu, 16 Jul 2015 11:51:38 +0000 (+0000) Subject: Handle exit phi without header phi in create_parallel_loop X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7781d2626e5deb6cd1c683498cc19f4f7daa04e8;p=gcc.git Handle exit phi without header phi in create_parallel_loop 2015-07-16 Tom de Vries * tree-parloops.c (create_parallel_loop): Handle case that exit phi does not have a corresponding loop header phi. From-SVN: r225873 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfdf5e75747..764e8bc874e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-07-16 Tom de Vries + + * tree-parloops.c (create_parallel_loop): Handle case that exit phi does + not have a corresponding loop header phi. + 2015-07-16 Tom de Vries * tree-parloops.c (create_loads_for_reductions): Handle case that diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 2390d9ec505..ec418343c26 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2050,13 +2050,17 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, !gsi_end_p (gpi); gsi_next (&gpi)) { source_location locus; - tree def; gphi *phi = gpi.phi (); - gphi *stmt; + tree def = PHI_ARG_DEF_FROM_EDGE (phi, exit); + gimple def_stmt = SSA_NAME_DEF_STMT (def); - stmt = as_a ( - SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit))); + /* If the exit phi is not connected to a header phi in the same loop, this + value is not modified in the loop, and we're done with this phi. */ + if (!(gimple_code (def_stmt) == GIMPLE_PHI + && gimple_bb (def_stmt) == loop->header)) + continue; + gphi *stmt = as_a (def_stmt); def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop)); locus = gimple_phi_arg_location_from_edge (stmt, loop_preheader_edge (loop));