From: Tom de Vries Date: Thu, 26 Apr 2018 13:26:38 +0000 (+0000) Subject: [nvptx] Fix branch-around-nothing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6beefdbdf33d56fe0d327688b85dc0cd25ce7a06;p=gcc.git [nvptx] Fix branch-around-nothing 2018-04-26 Tom de Vries 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61d92f8fa8e..d60f9625028 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-04-26 Tom de Vries + + 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 Tom de Vries diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index ca3fea3002d..4fd1e2b5095 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