+2015-07-16 Tom de Vries <tom@codesourcery.com>
+
+ * 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 <tom@codesourcery.com>
* tree-parloops.c (create_loads_for_reductions): Handle case that
!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 <gphi *> (
- 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 <gphi *> (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));