Commit 87654f18 by Jakub Jelinek Committed by Jakub Jelinek

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
parent df6d3ac9
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/89679
* expmed.c (expand_mult_const): Don't add a REG_EQUAL note if it
would contain a paradoxical SUBREG.
2019-03-14 Richard Biener <rguenther@suse.de> 2019-03-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/89710 PR tree-optimization/89710
......
...@@ -3356,13 +3356,20 @@ expand_mult_const (machine_mode mode, rtx op0, HOST_WIDE_INT val, ...@@ -3356,13 +3356,20 @@ expand_mult_const (machine_mode mode, rtx op0, HOST_WIDE_INT val,
tem = gen_lowpart (nmode, op0); tem = gen_lowpart (nmode, op0);
} }
insn = get_last_insn (); /* Don't add a REG_EQUAL note if tem is a paradoxical SUBREG.
wide_int wval_so_far In that case, only the low bits of accum would be guaranteed to
= wi::uhwi (val_so_far, be equal to the content of the REG_EQUAL note, the upper bits
GET_MODE_PRECISION (as_a <scalar_mode> (nmode))); can be anything. */
rtx c = immed_wide_int_const (wval_so_far, nmode); if (!paradoxical_subreg_p (tem))
set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c), {
accum_inner); 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);
}
} }
} }
......
2019-03-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/89679
* gcc.dg/pr89679.c: New test.
2019-03-14 Richard Biener <rguenther@suse.de> 2019-03-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/89710 PR tree-optimization/89710
......
/* PR rtl-optimization/89679 */
/* { dg-do run } */
/* { dg-options "-Og -frerun-cse-after-loop -fno-tree-fre" } */
unsigned short g;
void
foo (unsigned long long x)
{
if (x != 0xffff)
__builtin_abort ();
}
int
main ()
{
#if __SIZEOF_SHORT__ == 2 && __SIZEOF_INT__ == 4 && __CHAR_BIT__ == 8
unsigned short d = 0;
unsigned long long x, c = ~0;
c = c >> d;
__builtin_memset (&d, c, 2);
x = d + g;
foo (x);
#endif
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment