Backport "Insert diverging jump alap in nvptx_single"

2017-07-18  Tom de Vries  <tom@codesourcery.com>

	backport from mainline:
	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.

From-SVN: r250308
This commit is contained in:
Tom de Vries 2017-07-18 13:06:07 +00:00 committed by Tom de Vries
parent 415f3135e6
commit bffd88f860
2 changed files with 28 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2017-07-18 Tom de Vries <tom@codesourcery.com>
backport from mainline:
PR target/81069
2017-07-17 Tom de Vries <tom@codesourcery.com>
* config/nvptx/nvptx.c (nvptx_single): Insert diverging branch as late
as possible.
2017-07-18 Georg-Johann Lay <avr@gjlay.de>
Backport from 2017-07-18 trunk r250301.

View File

@ -3860,9 +3860,25 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
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);