re PR tree-optimization/86492 (store-merging wrong-code)

PR tree-optimization/86492
	* gimple-ssa-store-merging.c
	(imm_store_chain_info::coalesce_immediate_stores): Call
	check_no_overlap even for the merge_overlapping case.  Formatting fix.

	* gcc.c-torture/execute/pr86492.c: New test.

From-SVN: r262576
This commit is contained in:
Jakub Jelinek 2018-07-12 09:39:33 +02:00 committed by Jakub Jelinek
parent cd0762f3ca
commit a7fe648221
4 changed files with 54 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2018-07-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86492
* gimple-ssa-store-merging.c
(imm_store_chain_info::coalesce_immediate_stores): Call
check_no_overlap even for the merge_overlapping case. Formatting fix.
2018-07-12 Richard Biener <rguenther@suse.de>
PR middle-end/86479

View File

@ -2702,7 +2702,12 @@ imm_store_chain_info::coalesce_immediate_stores ()
{
/* Only allow overlapping stores of constants. */
if (info->rhs_code == INTEGER_CST
&& merged_store->stores[0]->rhs_code == INTEGER_CST)
&& merged_store->stores[0]->rhs_code == INTEGER_CST
&& check_no_overlap (m_store_info, i, INTEGER_CST,
MAX (merged_store->last_order, info->order),
MAX (merged_store->start
+ merged_store->width,
info->bitpos + info->bitsize)))
{
merged_store->merge_overlapping (info);
goto done;
@ -2732,10 +2737,8 @@ imm_store_chain_info::coalesce_immediate_stores ()
info->ops_swapped_p = true;
}
if (check_no_overlap (m_store_info, i, info->rhs_code,
MAX (merged_store->last_order,
info->order),
MAX (merged_store->start
+ merged_store->width,
MAX (merged_store->last_order, info->order),
MAX (merged_store->start + merged_store->width,
info->bitpos + info->bitsize)))
{
/* Turn MEM_REF into BIT_INSERT_EXPR for bit-field stores. */

View File

@ -1,3 +1,8 @@
2018-07-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86492
* gcc.c-torture/execute/pr86492.c: New test.
2018-07-12 Richard Biener <rguenther@suse.de>
PR c/86453

View File

@ -0,0 +1,34 @@
/* PR tree-optimization/86492 */
union U
{
unsigned int r;
struct S
{
unsigned int a:12;
unsigned int b:4;
unsigned int c:16;
} f;
};
__attribute__((noipa)) unsigned int
foo (unsigned int x)
{
union U u;
u.r = 0;
u.f.c = x;
u.f.b = 0xe;
return u.r;
}
int
main ()
{
union U u;
if (__CHAR_BIT__ * __SIZEOF_INT__ != 32 || sizeof (u.r) != sizeof (u.f))
return 0;
u.r = foo (0x72);
if (u.f.a != 0 || u.f.b != 0xe || u.f.c != 0x72)
__builtin_abort ();
return 0;
}