+2017-07-17 Tom de Vries <tom@codesourcery.com>
+
+ PR target/81069
+ * config/nvptx/nvptx.c (nvptx_single): Insert diverging branch as late
+ as possible.
+
2017-07-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
* gcc/config/sparc/rtemself.h (TARGET_OS_CPP_BUILTINS): Add
rtx_insn *tail = BB_END (to);
unsigned skip_mask = mask;
- /* Find first insn of from block */
- while (head != BB_END (from) && !INSN_P (head))
- head = NEXT_INSN (head);
+ while (true)
+ {
+ /* Find first insn of from block. */
+ while (head != BB_END (from) && !INSN_P (head))
+ head = NEXT_INSN (head);
+
+ if (from == to)
+ break;
+
+ if (!(JUMP_P (head) && single_succ_p (from)))
+ break;
+
+ basic_block jump_target = single_succ (from);
+ if (!single_pred_p (jump_target))
+ break;
+
+ from = jump_target;
+ head = BB_HEAD (from);
+ }
/* Find last insn of to block */
rtx_insn *limit = from == to ? head : BB_HEAD (to);