summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-24 17:00:57 +0000
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>2017-11-24 17:00:57 +0000
commitc435c373b6bdc3a068bad3b1d6eae10756379922 (patch)
tree28ac31c813ed167dd18693269c5f2a5395007b7a /gcc/combine.c
parent4f228e5ea6f891ab2826cd4fb15ee5035150983c (diff)
downloadgcc-c435c373b6bdc3a068bad3b1d6eae10756379922.tar.gz
combine: Don't split insns if half is unused (PR82621)
If we have a PARALLEL of two SETs, and one half is unused, we currently happily split that into two instructions (albeit the unused one is useless). Worse, as PR82621 shows, combine will happily merge this insn into I3 even if some intervening insn sets the same register again, which is wrong. This fixes it by not splitting PARALLELs with REG_UNUSED notes. It all is handled fine by combine in that case; just the "single set that is unused" case isn't handled properly. This also results in better code: combine will now actually throw away the unused SET. (It still won't do that in an I3). PR rtl-optimization/82621 * combine.c (try_combine): Do not split PARALLELs of two SETs if the dest of one of those SETs is unused. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255142 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index fff1c7e7bd4..c6257f60488 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2964,7 +2964,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
&& is_parallel_of_n_reg_sets (PATTERN (i2), 2)
&& can_split_parallel_of_n_reg_sets (i2, 2)
&& !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3)
- && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3))
+ && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3)
+ && !find_reg_note (i2, REG_UNUSED, 0))
{
/* If there is no I1, there is no I0 either. */
i0 = i1;