diff options
author | Tom de Vries <tom@codesourcery.com> | 2018-04-26 13:26:38 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2018-04-26 13:26:38 +0000 |
commit | 6beefdbdf33d56fe0d327688b85dc0cd25ce7a06 (patch) | |
tree | a205bc00455cfd119aaedb5f7d48a8a1085ac023 /gcc/config | |
parent | d160ae7814db14b36fc7eacc5fc14b77604837a1 (diff) | |
download | gcc-6beefdbdf33d56fe0d327688b85dc0cd25ce7a06.zip gcc-6beefdbdf33d56fe0d327688b85dc0cd25ce7a06.tar.gz gcc-6beefdbdf33d56fe0d327688b85dc0cd25ce7a06.tar.bz2 |
[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
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/nvptx/nvptx.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index ca3fea3..4fd1e2b 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -3989,6 +3989,27 @@ bb_first_real_insn (basic_block bb) } #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 TO is the outgoing block. These may be the same block. Insert at start of FROM: @@ -4014,9 +4035,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) while (true) { /* Find first insn of from block. */ - while (head != BB_END (from) - && (!INSN_P (head) - || recog_memoized (head) == CODE_FOR_nvptx_barsync)) + while (head != BB_END (from) && !needs_neutering_p (head)) head = NEXT_INSN (head); if (from == to) @@ -4057,22 +4076,9 @@ nvptx_single (unsigned mask, basic_block from, basic_block to) if (tail == head) { /* If this is empty, do nothing. */ - if (!head || !INSN_P (head)) + if (!head || !needs_neutering_p (head)) 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 we're only doing vector single, there's no need to |