diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2017-12-12 02:15:30 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2017-12-12 02:15:30 +0000 |
commit | 65f4b8759bda30d63404acb381b24a2ec960e667 (patch) | |
tree | c93804c181ab43d09f05acc90198b1f0fdd213e8 /gcc/omp-expand.c | |
parent | 36f52e8f0812546e6cb533b384b29f56570624ff (diff) | |
download | gcc-65f4b8759bda30d63404acb381b24a2ec960e667.zip gcc-65f4b8759bda30d63404acb381b24a2ec960e667.tar.gz gcc-65f4b8759bda30d63404acb381b24a2ec960e667.tar.bz2 |
[SFN] not-quite-boilerplate changes in preparation to introduce nonbind markers
This patch adjusts numerous parts of the compiler that would
malfunction should they find debug markers at points where they may be
introduced. The changes purport to allow the compiler to pass
bootstrap-debug-lean (-fcompare-debug in stage3) at various
optimization levels, as well as bootstrap-debug-lib (-fcompare-debug
for target libraries), even after the compiler is changed so that
debug markers are introduced in code streams at spots where earlier
debug stmts, insns and notes wouldn't normally appear.
This patch depends on an earlier SFN boilerplate patch, and on another
SFN patch that introduces new RTL insn-walking functions.
for gcc/ChangeLog
* cfgcleanup.c (delete_unreachable_blocks): Use alternate
block removal order if MAY_HAVE_DEBUG_BIND_INSNS.
* cfgexpand.c (label_rtx_for_bb): Skip debug insns.
* cfgrtl.c (try_redirect_by_replacing_jump): Skip debug insns.
(rtl_tidy_fallthru_edge): Likewise.
(rtl_verify_fallthru): Likewise.
(rtl_verify_bb_layout): Likewise.
(skip_insns_after_block): Likewise.
(duplicate_insn_chain): Use DEBUG_BIND_INSN_P.
* dwarf2out.c: Include print-rtl.h.
(dwarf2out_next_real_insn): New.
(dwarf2out_var_location): Call it. Disregard begin stmt markers.
Dump debug binds in asm comments.
* gimple-iterator.c (gimple_find_edge_insert_loc): Skip debug stmts.
* gimple-iterator.h (gsi_start_bb_nondebug): Remove; adjust
callers to use gsi_start_nondebug_bb instead.
(gsi_after_labels): Skip gimple debug stmts.
(gsi_start_nondebug): New.
* gimple-loop-interchange.c (find_deps_in_bb_for_stmt): Adjust.
(proper_loop_form_for_interchange): Adjust.
* gimple-low.c (gimple_seq_may_fallthru): Take last nondebug stmt.
* gimple.h (gimple_seq_last_nondebug_stmt): New.
* gimplify.c (last_stmt_in_scope): Skip debug stmts.
(collect_fallthrough_labels): Likewise.
(should_warn_for_implicit_fallthrough): Likewise.
(warn_implicit_fallthrough_r): Likewise.
(expand_FALLTHROUGH_r): Likewise.
* graphite-isl-ast-to-gimple.c (gsi_insert_earliest): Adjust.
(graphite_copy_stmts_from_block): Skip nonbind markers.
* haifa-sched.c (sched_extend_bb): Skip debug insns.
* ipa-icf-gimple.c (func_checker::compare_bb): Adjust.
* jump.c (clean_barriers): Skip debug insns.
* omp-expand.c (expand_parallel_call): Skip debug insns.
(expand_task_call): Likewise.
(remove_exit_barrier): Likewise.
(expand_omp_taskreg): Likewise.
(expand_omp_for_init_counts): Likewise.
(expand_omp_for_generic): Likewise.
(expand_omp_for_static_nochunk): Likewise.
(expand_omp_for_static_chunk): Likewise.
(expand_omp_simd): Likewise.
(expand_omp_taskloop_for_outer): Likewise.
(expand_omp_taskloop_for_inner): Likewise.
(expand_oacc_for): Likewise.
(expand_omp_sections): Likewise.
(expand_omp_single): Likewise.
(expand_omp_synch): Likewise.
(expand_omp_atomic_load): Likewise.
(expand_omp_atomic_store): Likewise.
(expand_omp_atomic_fetch_op): Likewise.
(expand_omp_atomic_pipeline): Likewise.
(expand_omp_atomic_mutex): Likewise.
(expand_omp_target): Likewise.
(grid_expand_omp_for_loop): Likewise.
(grid_expand_target_grid_body): Likewise.
(build_omp_regions_1): Likewise.
* omp-low.c (check_combined_parallel): Skip debug stmts.
* postreload.c (fixup_debug_insns): Skip nonbind debug insns.
* regcprop.c (find_oldest_value_reg): Ensure REGNO is not a pseudo.
* sese.c (sese_trivially_empty_bb_p): Call is_gimple_debug in
test.
* tree-cfg.c (make_blobs_1): Skip debug stmts.
(make_edges): Likewise.
(cleanup_dead_labels): Likewise.
(gimple_can_merge_blocks_p): Likewise.
(stmt_starts_bb_p): Likewise.
(gimple_block_label): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
* tree-cfgcleanup.c (remove_forwarder_block): Rearrange skipping
of debug stmts.
(execute_cleanup_cfg_post_optimizing): Dump enumerated decls with
TDF_SLIM.
* tree-pretty-print (print_declaration): Omit initializer in slim
dumps.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Mark begin stmt
markers.
(eliminate_unnecessary_stmts): Stabilize block removal order.
* tree-ssa-tail-merge.c (find_duplicate): Skip debug stmts.
* var-tracking.c (get_first_insn): New.
(vt_emit_notes): Call it.
(vt_initialize): Walk any insns before the first BB.
(delete_debug_insns): Likewise.
From-SVN: r255566
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 153 |
1 files changed, 80 insertions, 73 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 4aadc6f..0248833 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -694,7 +694,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb, false, GSI_CONTINUE_LINKING); } - gsi = gsi_last_bb (bb); + gsi = gsi_last_nondebug_bb (bb); t = gimple_omp_parallel_data_arg (entry_stmt); if (t == NULL) t1 = null_pointer_node; @@ -834,7 +834,7 @@ expand_task_call (struct omp_region *region, basic_block bb, else priority = integer_zero_node; - gsi = gsi_last_bb (bb); + gsi = gsi_last_nondebug_bb (bb); tree t = gimple_omp_task_data_arg (entry_stmt); if (t == NULL) t2 = null_pointer_node; @@ -911,15 +911,15 @@ remove_exit_barrier (struct omp_region *region) statements that can appear in between are extremely limited -- no memory operations at all. Here, we allow nothing at all, so the only thing we allow to precede this GIMPLE_OMP_RETURN is a label. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); - gsi_prev (&gsi); + gsi_prev_nondebug (&gsi); if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL) return; FOR_EACH_EDGE (e, ei, exit_bb->preds) { - gsi = gsi_last_bb (e->src); + gsi = gsi_last_nondebug_bb (e->src); if (gsi_end_p (gsi)) continue; stmt = gsi_stmt (gsi); @@ -1135,7 +1135,7 @@ expand_omp_taskreg (struct omp_region *region) entry_succ_e = single_succ_edge (entry_bb); - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK); gsi_remove (&gsi, true); @@ -1248,7 +1248,7 @@ expand_omp_taskreg (struct omp_region *region) /* Split ENTRY_BB at GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK, so that it can be moved to the child function. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); stmt = gsi_stmt (gsi); gcc_assert (stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL || gimple_code (stmt) == GIMPLE_OMP_TASK)); @@ -1264,7 +1264,7 @@ expand_omp_taskreg (struct omp_region *region) gcc_assert (e2->dest == region->exit); remove_edge (BRANCH_EDGE (entry_bb)); set_immediate_dominator (CDI_DOMINATORS, e2->dest, e->src); - gsi = gsi_last_bb (region->exit); + gsi = gsi_last_nondebug_bb (region->exit); gcc_assert (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); gsi_remove (&gsi, true); @@ -1273,7 +1273,7 @@ expand_omp_taskreg (struct omp_region *region) /* Convert GIMPLE_OMP_{RETURN,CONTINUE} into a RETURN_EXPR. */ if (exit_bb) { - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gcc_assert (!gsi_end_p (gsi) && (gimple_code (gsi_stmt (gsi)) == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))); @@ -1732,7 +1732,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, if (l2_dom_bb == NULL) l2_dom_bb = entry_bb; entry_bb = e->dest; - *gsi = gsi_last_bb (entry_bb); + *gsi = gsi_last_nondebug_bb (entry_bb); } if (POINTER_TYPE_P (itype)) @@ -2537,7 +2537,7 @@ expand_omp_for_generic (struct omp_region *region, l3_bb = BRANCH_EDGE (entry_bb)->dest; exit_bb = region->exit; - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); if (fd->ordered @@ -2567,7 +2567,7 @@ expand_omp_for_generic (struct omp_region *region, e = split_block (entry_bb, gsi_stmt (gsi)); entry_bb = e->dest; make_edge (zero_iter1_bb, entry_bb, EDGE_FALLTHRU); - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); set_immediate_dominator (CDI_DOMINATORS, entry_bb, get_immediate_dominator (CDI_DOMINATORS, zero_iter1_bb)); @@ -2588,7 +2588,7 @@ expand_omp_for_generic (struct omp_region *region, e = split_block (entry_bb, gsi_stmt (gsi)); entry_bb = e->dest; make_edge (zero_iter2_bb, entry_bb, EDGE_FALLTHRU); - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); set_immediate_dominator (CDI_DOMINATORS, entry_bb, get_immediate_dominator (CDI_DOMINATORS, zero_iter2_bb)); @@ -3006,7 +3006,7 @@ expand_omp_for_generic (struct omp_region *region, { /* Code to control the increment and predicate for the sequential loop goes in the CONT_BB. */ - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE); vmain = gimple_omp_continue_control_use (cont_stmt); @@ -3072,7 +3072,7 @@ expand_omp_for_generic (struct omp_region *region, } /* Add the loop cleanup function. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); if (gimple_omp_return_nowait_p (gsi_stmt (gsi))) t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT); else if (gimple_omp_return_lhs (gsi_stmt (gsi))) @@ -3292,7 +3292,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, exit_bb = region->exit; /* Iteration space partitioning goes in ENTRY_BB. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); if (fd->collapse > 1) @@ -3424,7 +3424,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); second_bb = split_block (entry_bb, cond_stmt)->dest; - gsi = gsi_last_bb (second_bb); + gsi = gsi_last_nondebug_bb (second_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); gsi_insert_before (&gsi, gimple_build_assign (tt, build_int_cst (itype, 0)), @@ -3434,7 +3434,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); third_bb = split_block (second_bb, assign_stmt)->dest; - gsi = gsi_last_bb (third_bb); + gsi = gsi_last_nondebug_bb (third_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); t = build2 (MULT_EXPR, itype, q, threadid); @@ -3576,7 +3576,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, { /* The code controlling the sequential loop replaces the GIMPLE_OMP_CONTINUE. */ - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE); vmain = gimple_omp_continue_control_use (cont_stmt); @@ -3609,7 +3609,7 @@ expand_omp_for_static_nochunk (struct omp_region *region, } /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); if (!gimple_omp_return_nowait_p (gsi_stmt (gsi))) { t = gimple_omp_return_lhs (gsi_stmt (gsi)); @@ -3776,7 +3776,7 @@ expand_omp_for_static_chunk (struct omp_region *region, exit_bb = region->exit; /* Trip and adjustment setup goes in ENTRY_BB. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); if (fd->collapse > 1) @@ -4082,7 +4082,7 @@ expand_omp_for_static_chunk (struct omp_region *region, { /* The code controlling the sequential loop goes in CONT_BB, replacing the GIMPLE_OMP_CONTINUE. */ - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); vmain = gimple_omp_continue_control_use (cont_stmt); vback = gimple_omp_continue_control_def (cont_stmt); @@ -4126,7 +4126,7 @@ expand_omp_for_static_chunk (struct omp_region *region, } /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); if (!gimple_omp_return_nowait_p (gsi_stmt (gsi))) { t = gimple_omp_return_lhs (gsi_stmt (gsi)); @@ -4399,7 +4399,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) exit_bb = region->exit; l2_dom_bb = NULL; - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); /* Not needed in SSA form right now. */ @@ -4494,7 +4494,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) if (!broken_loop) { /* Code to control the increment goes in the CONT_BB. */ - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); stmt = gsi_stmt (gsi); gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE); @@ -4592,7 +4592,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) } /* Remove GIMPLE_OMP_RETURN. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gsi_remove (&gsi, true); /* Connect the new blocks. */ @@ -4718,7 +4718,7 @@ expand_omp_taskloop_for_outer (struct omp_region *region, gcc_assert (BRANCH_EDGE (entry_bb)->dest == FALLTHRU_EDGE (cont_bb)->dest); exit_bb = region->exit; - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gimple *for_stmt = gsi_stmt (gsi); gcc_assert (gimple_code (for_stmt) == GIMPLE_OMP_FOR); if (fd->collapse > 1) @@ -4819,10 +4819,10 @@ expand_omp_taskloop_for_outer (struct omp_region *region, gsi = gsi_for_stmt (for_stmt); gsi_remove (&gsi, true); - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gsi_remove (&gsi, true); - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gsi_remove (&gsi, true); FALLTHRU_EDGE (entry_bb)->probability = profile_probability::always (); @@ -4896,7 +4896,7 @@ expand_omp_taskloop_for_inner (struct omp_region *region, exit_bb = region->exit; /* Iteration space partitioning goes in ENTRY_BB. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR); if (fd->collapse > 1) @@ -4975,7 +4975,7 @@ expand_omp_taskloop_for_inner (struct omp_region *region, { /* The code controlling the sequential loop replaces the GIMPLE_OMP_CONTINUE. */ - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE); vmain = gimple_omp_continue_control_use (cont_stmt); @@ -5012,7 +5012,7 @@ expand_omp_taskloop_for_inner (struct omp_region *region, gsi_remove (&gsi, true); /* Remove the GIMPLE_OMP_RETURN statement. */ - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gsi_remove (&gsi, true); FALLTHRU_EDGE (entry_bb)->probability = profile_probability::always (); @@ -5195,7 +5195,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) entry_bb = split->src; /* Chunk setup goes at end of entry_bb, replacing the omp_for. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); gomp_for *for_stmt = as_a <gomp_for *> (gsi_stmt (gsi)); loc = gimple_location (for_stmt); @@ -5322,7 +5322,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) if (gimple_in_ssa_p (cfun)) { - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); offset = gimple_omp_continue_control_use (cont_stmt); @@ -5446,7 +5446,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) occur, especially when noreturn routines are involved. */ if (cont_bb) { - gsi = gsi_last_bb (cont_bb); + gsi = gsi_last_nondebug_bb (cont_bb); gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); loc = gimple_location (cont_stmt); @@ -5535,7 +5535,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) } } - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); loc = gimple_location (gsi_stmt (gsi)); @@ -5760,7 +5760,7 @@ expand_omp_sections (struct omp_region *region) len = EDGE_COUNT (l0_bb->succs); gcc_assert (len > 0); e = EDGE_SUCC (l0_bb, len - 1); - si = gsi_last_bb (e->dest); + si = gsi_last_nondebug_bb (e->dest); l2 = NULL_TREE; if (gsi_end_p (si) || gimple_code (gsi_stmt (si)) != GIMPLE_OMP_SECTION) @@ -5768,7 +5768,7 @@ expand_omp_sections (struct omp_region *region) else FOR_EACH_EDGE (e, ei, l0_bb->succs) { - si = gsi_last_bb (e->dest); + si = gsi_last_nondebug_bb (e->dest); if (gsi_end_p (si) || gimple_code (gsi_stmt (si)) != GIMPLE_OMP_SECTION) { @@ -5793,7 +5793,7 @@ expand_omp_sections (struct omp_region *region) /* The call to GOMP_sections_start goes in ENTRY_BB, replacing the GIMPLE_OMP_SECTIONS statement. */ - si = gsi_last_bb (entry_bb); + si = gsi_last_nondebug_bb (entry_bb); sections_stmt = as_a <gomp_sections *> (gsi_stmt (si)); gcc_assert (gimple_code (sections_stmt) == GIMPLE_OMP_SECTIONS); vin = gimple_omp_sections_control (sections_stmt); @@ -5817,7 +5817,7 @@ expand_omp_sections (struct omp_region *region) /* The switch() statement replacing GIMPLE_OMP_SECTIONS_SWITCH goes in L0_BB. */ - switch_si = gsi_last_bb (l0_bb); + switch_si = gsi_last_nondebug_bb (l0_bb); gcc_assert (gimple_code (gsi_stmt (switch_si)) == GIMPLE_OMP_SECTIONS_SWITCH); if (exit_reachable) { @@ -5859,7 +5859,7 @@ expand_omp_sections (struct omp_region *region) u = build_case_label (u, NULL, t); label_vec.quick_push (u); - si = gsi_last_bb (s_entry_bb); + si = gsi_last_nondebug_bb (s_entry_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SECTION); gcc_assert (i < len || gimple_omp_section_last_p (gsi_stmt (si))); gsi_remove (&si, true); @@ -5868,7 +5868,7 @@ expand_omp_sections (struct omp_region *region) if (s_exit_bb == NULL) continue; - si = gsi_last_bb (s_exit_bb); + si = gsi_last_nondebug_bb (s_exit_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_RETURN); gsi_remove (&si, true); @@ -5894,7 +5894,7 @@ expand_omp_sections (struct omp_region *region) tree bfn_decl; /* Code to get the next section goes in L1_BB. */ - si = gsi_last_bb (l1_bb); + si = gsi_last_nondebug_bb (l1_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_CONTINUE); bfn_decl = builtin_decl_explicit (BUILT_IN_GOMP_SECTIONS_NEXT); @@ -5907,7 +5907,7 @@ expand_omp_sections (struct omp_region *region) } /* Cleanup function replaces GIMPLE_OMP_RETURN in EXIT_BB. */ - si = gsi_last_bb (l2_bb); + si = gsi_last_nondebug_bb (l2_bb); if (gimple_omp_return_nowait_p (gsi_stmt (si))) t = builtin_decl_explicit (BUILT_IN_GOMP_SECTIONS_END_NOWAIT); else if (gimple_omp_return_lhs (gsi_stmt (si))) @@ -5935,12 +5935,12 @@ expand_omp_single (struct omp_region *region) entry_bb = region->entry; exit_bb = region->exit; - si = gsi_last_bb (entry_bb); + si = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SINGLE); gsi_remove (&si, true); single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU; - si = gsi_last_bb (exit_bb); + si = gsi_last_nondebug_bb (exit_bb); if (!gimple_omp_return_nowait_p (gsi_stmt (si))) { tree t = gimple_omp_return_lhs (gsi_stmt (si)); @@ -5963,7 +5963,7 @@ expand_omp_synch (struct omp_region *region) entry_bb = region->entry; exit_bb = region->exit; - si = gsi_last_bb (entry_bb); + si = gsi_last_nondebug_bb (entry_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SINGLE || gimple_code (gsi_stmt (si)) == GIMPLE_OMP_MASTER || gimple_code (gsi_stmt (si)) == GIMPLE_OMP_TASKGROUP @@ -5975,7 +5975,7 @@ expand_omp_synch (struct omp_region *region) if (exit_bb) { - si = gsi_last_bb (exit_bb); + si = gsi_last_nondebug_bb (exit_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_RETURN); gsi_remove (&si, true); single_succ_edge (exit_bb)->flags = EDGE_FALLTHRU; @@ -5996,7 +5996,7 @@ expand_omp_atomic_load (basic_block load_bb, tree addr, gimple *stmt; tree decl, call, type, itype; - gsi = gsi_last_bb (load_bb); + gsi = gsi_last_nondebug_bb (load_bb); stmt = gsi_stmt (gsi); gcc_assert (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD); loc = gimple_location (stmt); @@ -6026,7 +6026,7 @@ expand_omp_atomic_load (basic_block load_bb, tree addr, gsi_remove (&gsi, true); store_bb = single_succ (load_bb); - gsi = gsi_last_bb (store_bb); + gsi = gsi_last_nondebug_bb (store_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_STORE); gsi_remove (&gsi, true); @@ -6052,14 +6052,14 @@ expand_omp_atomic_store (basic_block load_bb, tree addr, machine_mode imode; bool exchange; - gsi = gsi_last_bb (load_bb); + gsi = gsi_last_nondebug_bb (load_bb); stmt = gsi_stmt (gsi); gcc_assert (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD); /* If the load value is needed, then this isn't a store but an exchange. */ exchange = gimple_omp_atomic_need_value_p (stmt); - gsi = gsi_last_bb (store_bb); + gsi = gsi_last_nondebug_bb (store_bb); stmt = gsi_stmt (gsi); gcc_assert (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE); loc = gimple_location (stmt); @@ -6104,7 +6104,7 @@ expand_omp_atomic_store (basic_block load_bb, tree addr, gsi_remove (&gsi, true); /* Remove the GIMPLE_OMP_ATOMIC_LOAD that we verified above. */ - gsi = gsi_last_bb (load_bb); + gsi = gsi_last_nondebug_bb (load_bb); gsi_remove (&gsi, true); if (gimple_in_ssa_p (cfun)) @@ -6151,10 +6151,17 @@ expand_omp_atomic_fetch_op (basic_block load_bb, gsi = gsi_after_labels (store_bb); stmt = gsi_stmt (gsi); + if (is_gimple_debug (stmt)) + { + gsi_next_nondebug (&gsi); + if (gsi_end_p (gsi)) + return false; + stmt = gsi_stmt (gsi); + } loc = gimple_location (stmt); if (!is_gimple_assign (stmt)) return false; - gsi_next (&gsi); + gsi_next_nondebug (&gsi); if (gimple_code (gsi_stmt (gsi)) != GIMPLE_OMP_ATOMIC_STORE) return false; need_new = gimple_omp_atomic_need_value_p (gsi_stmt (gsi)); @@ -6218,7 +6225,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb, if (!can_compare_and_swap_p (imode, true) || !can_atomic_load_p (imode)) return false; - gsi = gsi_last_bb (load_bb); + gsi = gsi_last_nondebug_bb (load_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_LOAD); /* OpenMP does not imply any barrier-like semantics on its atomic ops. @@ -6241,10 +6248,10 @@ expand_omp_atomic_fetch_op (basic_block load_bb, force_gimple_operand_gsi (&gsi, call, true, NULL_TREE, true, GSI_SAME_STMT); gsi_remove (&gsi, true); - gsi = gsi_last_bb (store_bb); + gsi = gsi_last_nondebug_bb (store_bb); gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_STORE); gsi_remove (&gsi, true); - gsi = gsi_last_bb (store_bb); + gsi = gsi_last_nondebug_bb (store_bb); stmt = gsi_stmt (gsi); gsi_remove (&gsi, true); @@ -6297,7 +6304,7 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb, return false; /* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */ - si = gsi_last_bb (load_bb); + si = gsi_last_nondebug_bb (load_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD); /* For floating-point values, we'll need to view-convert them to integers @@ -6377,7 +6384,7 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb, } gsi_remove (&si, true); - si = gsi_last_bb (store_bb); + si = gsi_last_nondebug_bb (store_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_STORE); if (iaddr == addr) @@ -6480,7 +6487,7 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb, gassign *stmt; tree t; - si = gsi_last_bb (load_bb); + si = gsi_last_nondebug_bb (load_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD); t = builtin_decl_explicit (BUILT_IN_GOMP_ATOMIC_START); @@ -6491,7 +6498,7 @@ expand_omp_atomic_mutex (basic_block load_bb, basic_block store_bb, gsi_insert_before (&si, stmt, GSI_SAME_STMT); gsi_remove (&si, true); - si = gsi_last_bb (store_bb); + si = gsi_last_nondebug_bb (store_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_STORE); stmt = gimple_build_assign (build_simple_mem_ref (unshare_expr (addr)), @@ -6990,7 +6997,7 @@ expand_omp_target (struct omp_region *region) /* Split ENTRY_BB at GIMPLE_*, so that it can be moved to the child function. */ - gsi = gsi_last_bb (entry_bb); + gsi = gsi_last_nondebug_bb (entry_bb); stmt = gsi_stmt (gsi); gcc_assert (stmt && gimple_code (stmt) == gimple_code (entry_stmt)); @@ -7002,7 +7009,7 @@ expand_omp_target (struct omp_region *region) /* Convert GIMPLE_OMP_RETURN into a RETURN_EXPR. */ if (exit_bb) { - gsi = gsi_last_bb (exit_bb); + gsi = gsi_last_nondebug_bb (exit_bb); gcc_assert (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); stmt = gimple_build_return (NULL); @@ -7184,7 +7191,7 @@ expand_omp_target (struct omp_region *region) e = split_block_after_labels (new_bb); else { - gsi = gsi_last_bb (new_bb); + gsi = gsi_last_nondebug_bb (new_bb); gsi_prev (&gsi); e = split_block (new_bb, gsi_stmt (gsi)); } @@ -7219,11 +7226,11 @@ expand_omp_target (struct omp_region *region) make_edge (else_bb, new_bb, EDGE_FALLTHRU); device = tmp_var; - gsi = gsi_last_bb (new_bb); + gsi = gsi_last_nondebug_bb (new_bb); } else { - gsi = gsi_last_bb (new_bb); + gsi = gsi_last_nondebug_bb (new_bb); device = force_gimple_operand_gsi (&gsi, device, true, NULL_TREE, true, GSI_SAME_STMT); } @@ -7367,7 +7374,7 @@ expand_omp_target (struct omp_region *region) } if (data_region && region->exit) { - gsi = gsi_last_bb (region->exit); + gsi = gsi_last_nondebug_bb (region->exit); g = gsi_stmt (gsi); gcc_assert (g && gimple_code (g) == GIMPLE_OMP_RETURN); gsi_remove (&gsi, true); @@ -7448,17 +7455,17 @@ grid_expand_omp_for_loop (struct omp_region *kfor, bool intra_group) gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); } /* Remove the omp for statement. */ - gsi = gsi_last_bb (kfor->entry); + gsi = gsi_last_nondebug_bb (kfor->entry); gsi_remove (&gsi, true); /* Remove the GIMPLE_OMP_CONTINUE statement. */ - gsi = gsi_last_bb (kfor->cont); + gsi = gsi_last_nondebug_bb (kfor->cont); gcc_assert (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_CONTINUE); gsi_remove (&gsi, true); /* Replace the GIMPLE_OMP_RETURN with a barrier, if necessary. */ - gsi = gsi_last_bb (kfor->exit); + gsi = gsi_last_nondebug_bb (kfor->exit); gcc_assert (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); if (intra_group) @@ -7602,11 +7609,11 @@ grid_expand_target_grid_body (struct omp_region *target) grid_expand_omp_for_loop (kfor, false); /* Remove the omp for statement. */ - gimple_stmt_iterator gsi = gsi_last_bb (gpukernel->entry); + gimple_stmt_iterator gsi = gsi_last_nondebug_bb (gpukernel->entry); gsi_remove (&gsi, true); /* Replace the GIMPLE_OMP_RETURN at the end of the kernel region with a real return. */ - gsi = gsi_last_bb (gpukernel->exit); + gsi = gsi_last_nondebug_bb (gpukernel->exit); gcc_assert (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN); gimple *ret_stmt = gimple_build_return (NULL); @@ -7790,7 +7797,7 @@ build_omp_regions_1 (basic_block bb, struct omp_region *parent, gimple *stmt; basic_block son; - gsi = gsi_last_bb (bb); + gsi = gsi_last_nondebug_bb (bb); if (!gsi_end_p (gsi) && is_gimple_omp (gsi_stmt (gsi))) { struct omp_region *region; |