Hi. The PR is about a verification error where we have a FALLTHRU edge that contains barrier instruction. The instruction is created during bbpart pass in add_labels_and_missing_jumps (emit_barrier_after_bb). At that time, the basic blocks live in a different partition (hot,cold). Later then the edge is redirected and the basic blocks are in a same partition. The code in cfg_layout_redirect_edge_and_branch correctly sets FALLTHRU flag, but forgets to remove the created barrier.
The problem is seen during build of Firefox with LTO+PGO in one LTRANS unit. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2019-01-23 Martin Liska <mli...@suse.cz> PR lto/88858 * cfgrtl.c (cfg_layout_redirect_edge_and_branch): When BB_FOOTER contains a BARRIER and we're removing a crossing jump, remove the barrier. --- gcc/cfgrtl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 172bdf585d0..5dd316efb63 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -4396,6 +4396,25 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) "Removing crossing jump while redirecting edge form %i to %i\n", e->src->index, dest->index); delete_insn (BB_END (src)); + + /* Unlink a BARRIER that can be still in BB_FOOTER. */ + rtx_insn *insn = BB_FOOTER (src); + while (insn != NULL_RTX && !BARRIER_P (insn)) + insn = NEXT_INSN (insn); + + if (insn != NULL_RTX) + { + if (insn == BB_FOOTER (src)) + BB_FOOTER (src) = NULL; + else + { + if (PREV_INSN (insn)) + SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn); + if (NEXT_INSN (insn)) + SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn); + } + } + e->flags |= EDGE_FALLTHRU; }