diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-03-14 13:21:36 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-03-14 13:21:36 +0100 |
commit | 87654f1813a0f582645f72d87f7fb8c78b92ee6a (patch) | |
tree | 40dbf553b569f68381f8ca699e138c8daac87caa /gcc/expmed.c | |
parent | df6d3ac9aa35d4d9cd23bc70e961490c19e2477d (diff) | |
download | gcc-87654f1813a0f582645f72d87f7fb8c78b92ee6a.zip gcc-87654f1813a0f582645f72d87f7fb8c78b92ee6a.tar.gz gcc-87654f1813a0f582645f72d87f7fb8c78b92ee6a.tar.bz2 |
re PR rtl-optimization/89679 (wrong code with -Og -frerun-cse-after-loop -fno-tree-fre)
PR rtl-optimization/89679
* expmed.c (expand_mult_const): Don't add a REG_EQUAL note if it
would contain a paradoxical SUBREG.
* gcc.dg/pr89679.c: New test.
From-SVN: r269680
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index b7f55a7..d7f8e9a 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -3356,13 +3356,20 @@ expand_mult_const (machine_mode mode, rtx op0, HOST_WIDE_INT val, tem = gen_lowpart (nmode, op0); } - insn = get_last_insn (); - wide_int wval_so_far - = wi::uhwi (val_so_far, - GET_MODE_PRECISION (as_a <scalar_mode> (nmode))); - rtx c = immed_wide_int_const (wval_so_far, nmode); - set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c), - accum_inner); + /* Don't add a REG_EQUAL note if tem is a paradoxical SUBREG. + In that case, only the low bits of accum would be guaranteed to + be equal to the content of the REG_EQUAL note, the upper bits + can be anything. */ + if (!paradoxical_subreg_p (tem)) + { + insn = get_last_insn (); + wide_int wval_so_far + = wi::uhwi (val_so_far, + GET_MODE_PRECISION (as_a <scalar_mode> (nmode))); + rtx c = immed_wide_int_const (wval_so_far, nmode); + set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c), + accum_inner); + } } } |