Index: gcc/ChangeLog.gomp =================================================================== --- gcc/ChangeLog.gomp (revision 223867) +++ gcc/ChangeLog.gomp (working copy) @@ -1,3 +1,18 @@ +2015-05-29 Bernd Schmidt + + * gimple.def (GIMPLE_OMP_ENTRY_END): New code. + * gimple.h (gimple_build_omp_entry_end): Declare. + (CASE_GIMPLE_OMP): Add GIMPLE_OMP_ENTRY_END. + * gimple.c (gimple_build_omp_entry_end): New function. + * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_ENTRY_END. + * omp-low.c (expand_omp_target): Remove the entry end statement. + (predicate_bb): Don't predicate a block ending with + GIMPLE_OMP_ENTRY_END. + (lower_omp_target): Append a GIMPLE_OMP_ENTRY_END after the + ganglocal data allocation. + (make_gimple_omp_edges): Handle GIMPLE_OMP_ENTRY_END. + * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise. + 2015-05-28 Tom de Vries * passes.def: Replace pass_copy_prop with pass_fre. Surround with Index: gcc/gimple-low.c =================================================================== --- gcc/gimple-low.c (revision 223867) +++ gcc/gimple-low.c (working copy) @@ -337,6 +337,7 @@ lower_stmt (gimple_stmt_iterator *gsi, s case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: case GIMPLE_OMP_CONTINUE: + case GIMPLE_OMP_ENTRY_END: break; case GIMPLE_CALL: Index: gcc/gimple-pretty-print.c =================================================================== --- gcc/gimple-pretty-print.c (revision 223867) +++ gcc/gimple-pretty-print.c (working copy) @@ -2253,6 +2253,10 @@ pp_gimple_stmt_1 (pretty_printer *buffer pp_string (buffer, "GIMPLE_SECTIONS_SWITCH"); break; + case GIMPLE_OMP_ENTRY_END: + pp_string (buffer, "GIMPLE_OMP_ENTRY_END"); + break; + case GIMPLE_OMP_MASTER: case GIMPLE_OMP_TASKGROUP: case GIMPLE_OMP_ORDERED: Index: gcc/gimple.c =================================================================== --- gcc/gimple.c (revision 223867) +++ gcc/gimple.c (working copy) @@ -852,6 +852,15 @@ gimple_build_debug_source_bind_stat (tre } +/* Build a GIMPLE_OMP_ENTRY_END statement. */ + +gimple +gimple_build_omp_entry_end (void) +{ + return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0); +} + + /* Build a GIMPLE_OMP_CRITICAL statement. BODY is the sequence of statements for which only one thread can execute. Index: gcc/gimple.def =================================================================== --- gcc/gimple.def (revision 223867) +++ gcc/gimple.def (working copy) @@ -227,6 +227,10 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimp iteration in partially lowered OpenMP code. */ DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", GSS_OMP_CONTINUE) +/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block + into an offloaded region. */ +DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE) + /* GIMPLE_OMP_CRITICAL represents #pragma omp critical [name] Index: gcc/gimple.h =================================================================== --- gcc/gimple.h (revision 223867) +++ gcc/gimple.h (working copy) @@ -1351,6 +1351,7 @@ gimple gimple_build_omp_taskgroup (gimpl gomp_continue *gimple_build_omp_continue (tree, tree); gimple gimple_build_omp_ordered (gimple_seq); gimple gimple_build_omp_return (bool); +gimple gimple_build_omp_entry_end (); gomp_sections *gimple_build_omp_sections (gimple_seq, tree); gimple gimple_build_omp_sections_switch (void); gomp_single *gimple_build_omp_single (gimple_seq, tree); @@ -5597,6 +5598,7 @@ gimple_return_set_retbnd (gimple gs, tre case GIMPLE_OMP_ORDERED: \ case GIMPLE_OMP_CRITICAL: \ case GIMPLE_OMP_RETURN: \ + case GIMPLE_OMP_ENTRY_END: \ case GIMPLE_OMP_ATOMIC_LOAD: \ case GIMPLE_OMP_ATOMIC_STORE: \ case GIMPLE_OMP_CONTINUE Index: gcc/omp-low.c =================================================================== --- gcc/omp-low.c (revision 223867) +++ gcc/omp-low.c (working copy) @@ -9480,6 +9480,11 @@ expand_omp_target (struct omp_region *re } } + basic_block entry_succ_bb = single_succ (entry_bb); + gsi = gsi_last_bb (entry_succ_bb); + if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) + gsi_remove (&gsi, true); + if (offloaded && do_splitoff) { @@ -9501,7 +9506,6 @@ expand_omp_target (struct omp_region *re tree data_arg = gimple_omp_target_data_arg (entry_stmt); if (data_arg) { - basic_block entry_succ_bb = single_succ (entry_bb); gimple_stmt_iterator gsi; tree arg, narg; gimple tgtcopy_stmt = NULL; @@ -10131,6 +10135,8 @@ build_omp_regions_1 (basic_block bb, str gcc_assert (parent); parent->cont = bb; } + else if (code == GIMPLE_OMP_ENTRY_END) + gcc_assert (parent); else if (code == GIMPLE_OMP_SECTIONS_SWITCH) { /* GIMPLE_OMP_SECTIONS_SWITCH is part of @@ -10308,6 +10314,9 @@ predicate_bb (basic_block bb, struct omp basic_block skip_dest_bb = NULL; basic_block *adjust_bb_ptr = NULL; + if (gimple_code (stmt) == GIMPLE_OMP_ENTRY_END) + return; + if (gimple_code (stmt) == GIMPLE_COND) { tree cond_var = create_tmp_var (boolean_type_node); @@ -12705,6 +12714,7 @@ lower_omp_target (gimple_stmt_iterator * if (offloaded) { + gimple_seq_add_stmt (&new_body, gimple_build_omp_entry_end ()); if (has_reduction) { gimple_seq_add_seq (&irlist, tgt_body); @@ -13442,6 +13452,7 @@ make_gimple_omp_edges (basic_block bb, s fallthru = false; break; + case GIMPLE_OMP_ENTRY_END: case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: fallthru = true;