[nvptx] Fix branch-around-nothing

2018-04-26  Tom de Vries  <tom@codesourcery.com>

	PR target/84025
	* config/nvptx/nvptx.c (needs_neutering_p): New function.
	(nvptx_single): Use needs_neutering_p to skip over insns that do not
	need neutering.

From-SVN: r259676
This commit is contained in:
Tom de Vries 2018-04-26 13:26:38 +00:00 committed by Tom de Vries
parent d160ae7814
commit 6beefdbdf3
2 changed files with 30 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2018-04-26 Tom de Vries <tom@codesourcery.com>
PR target/84025
* config/nvptx/nvptx.c (needs_neutering_p): New function.
(nvptx_single): Use needs_neutering_p to skip over insns that do not
need neutering.
2018-04-26 Richard Biener <rguenther@suse.de> 2018-04-26 Richard Biener <rguenther@suse.de>
Tom de Vries <tom@codesourcery.com> Tom de Vries <tom@codesourcery.com>

View File

@ -3989,6 +3989,27 @@ bb_first_real_insn (basic_block bb)
} }
#endif #endif
/* Return true if INSN needs neutering. */
static bool
needs_neutering_p (rtx_insn *insn)
{
if (!INSN_P (insn))
return false;
switch (recog_memoized (insn))
{
case CODE_FOR_nvptx_fork:
case CODE_FOR_nvptx_forked:
case CODE_FOR_nvptx_joining:
case CODE_FOR_nvptx_join:
case CODE_FOR_nvptx_barsync:
return false;
default:
return true;
}
}
/* Single neutering according to MASK. FROM is the incoming block and /* Single neutering according to MASK. FROM is the incoming block and
TO is the outgoing block. These may be the same block. Insert at TO is the outgoing block. These may be the same block. Insert at
start of FROM: start of FROM:
@ -4014,9 +4035,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
while (true) while (true)
{ {
/* Find first insn of from block. */ /* Find first insn of from block. */
while (head != BB_END (from) while (head != BB_END (from) && !needs_neutering_p (head))
&& (!INSN_P (head)
|| recog_memoized (head) == CODE_FOR_nvptx_barsync))
head = NEXT_INSN (head); head = NEXT_INSN (head);
if (from == to) if (from == to)
@ -4057,22 +4076,9 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
if (tail == head) if (tail == head)
{ {
/* If this is empty, do nothing. */ /* If this is empty, do nothing. */
if (!head || !INSN_P (head)) if (!head || !needs_neutering_p (head))
return; return;
/* If this is a dummy insn, do nothing. */
switch (recog_memoized (head))
{
default:
break;
case CODE_FOR_nvptx_barsync:
case CODE_FOR_nvptx_fork:
case CODE_FOR_nvptx_forked:
case CODE_FOR_nvptx_joining:
case CODE_FOR_nvptx_join:
return;
}
if (cond_branch) if (cond_branch)
{ {
/* If we're only doing vector single, there's no need to /* If we're only doing vector single, there's no need to