diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-05-06 09:31:19 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-05-06 09:31:19 +0200 |
commit | f14848aea70066777faf201c0b6eb3c5520bfab9 (patch) | |
tree | 40a788d722939d41065beb0c1b63add3e11e28e6 /gcc/combine.c | |
parent | 366386c7a970bf6a32c5a2abb714ca6c7f4e7790 (diff) | |
download | gcc-f14848aea70066777faf201c0b6eb3c5520bfab9.zip gcc-f14848aea70066777faf201c0b6eb3c5520bfab9.tar.gz gcc-f14848aea70066777faf201c0b6eb3c5520bfab9.tar.bz2 |
combine: Don't replace SET_SRC with REG_EQUAL note content if SET_SRC has side-effects [PR94873]
There were some discussions about whether REG_EQUAL notes are valid on insns with a single
set which contains auto-inc-dec side-effects in the SET_SRC and the majority thinks that
it should be valid. So, this patch fixes the combiner to punt in that case, because otherwise
the auto-inc-dec side-effects from the SET_SRC are lost.
2020-05-06 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/94873
* combine.c (combine_instructions): Don't optimize using REG_EQUAL
note if SET_SRC (set) has side-effects.
* gcc.dg/pr94873.c: New test.
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 4c324f3..f69413a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1485,6 +1485,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs) if ((set = single_set (temp)) != 0 && (note = find_reg_equal_equiv_note (temp)) != 0 && (note = XEXP (note, 0), GET_CODE (note)) != EXPR_LIST + && ! side_effects_p (SET_SRC (set)) /* Avoid using a register that may already been marked dead by an earlier instruction. */ && ! unmentioned_reg_p (note, SET_SRC (set)) |