+2019-02-13 Martin Liska <mliska@suse.cz>
+
+ PR lto/88858
+ * cfgrtl.c (remove_barriers_from_footer): New function.
+ (try_redirect_by_replacing_jump): Use it.
+ (cfg_layout_redirect_edge_and_branch): Likewise.
+
2019-02-13 Xiong Hu Luo <luoxhu@linux.vnet.ibm.com>
* config/rs6000/altivec.h (vec_sbox_be, vec_cipher_be,
return as_a <rtx_code_label *> (BB_HEAD (block));
}
+/* Remove all barriers from BB_FOOTER of a BB. */
+
+static void
+remove_barriers_from_footer (basic_block bb)
+{
+ rtx_insn *insn = BB_FOOTER (bb);
+
+ /* Remove barriers but keep jumptables. */
+ while (insn)
+ {
+ if (BARRIER_P (insn))
+ {
+ if (PREV_INSN (insn))
+ SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
+ else
+ BB_FOOTER (bb) = NEXT_INSN (insn);
+ if (NEXT_INSN (insn))
+ SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
+ }
+ if (LABEL_P (insn))
+ return;
+ insn = NEXT_INSN (insn);
+ }
+}
+
/* Attempt to perform edge redirection by replacing possibly complex jump
instruction by unconditional jump or removing jump completely. This can
apply only if all edges now point to the same block. The parameters and
/* Selectively unlink whole insn chain. */
if (in_cfglayout)
{
- rtx_insn *insn = BB_FOOTER (src);
-
delete_insn_chain (kill_from, BB_END (src), false);
-
- /* Remove barriers but keep jumptables. */
- while (insn)
- {
- if (BARRIER_P (insn))
- {
- if (PREV_INSN (insn))
- SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
- else
- BB_FOOTER (src) = NEXT_INSN (insn);
- if (NEXT_INSN (insn))
- SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
- }
- if (LABEL_P (insn))
- break;
- insn = NEXT_INSN (insn);
- }
+ remove_barriers_from_footer (src);
}
else
delete_insn_chain (kill_from, PREV_INSN (BB_HEAD (target)),
"Removing crossing jump while redirecting edge form %i to %i\n",
e->src->index, dest->index);
delete_insn (BB_END (src));
+ remove_barriers_from_footer (src);
e->flags |= EDGE_FALLTHRU;
}