Commit a7fe6482 by Jakub Jelinek Committed by Jakub Jelinek

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
parent cd0762f3
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> 2018-07-12 Richard Biener <rguenther@suse.de>
PR middle-end/86479 PR middle-end/86479
......
...@@ -2702,7 +2702,12 @@ imm_store_chain_info::coalesce_immediate_stores () ...@@ -2702,7 +2702,12 @@ imm_store_chain_info::coalesce_immediate_stores ()
{ {
/* Only allow overlapping stores of constants. */ /* Only allow overlapping stores of constants. */
if (info->rhs_code == INTEGER_CST 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); merged_store->merge_overlapping (info);
goto done; goto done;
...@@ -2732,10 +2737,8 @@ imm_store_chain_info::coalesce_immediate_stores () ...@@ -2732,10 +2737,8 @@ imm_store_chain_info::coalesce_immediate_stores ()
info->ops_swapped_p = true; info->ops_swapped_p = true;
} }
if (check_no_overlap (m_store_info, i, info->rhs_code, if (check_no_overlap (m_store_info, i, info->rhs_code,
MAX (merged_store->last_order, MAX (merged_store->last_order, info->order),
info->order), MAX (merged_store->start + merged_store->width,
MAX (merged_store->start
+ merged_store->width,
info->bitpos + info->bitsize))) info->bitpos + info->bitsize)))
{ {
/* Turn MEM_REF into BIT_INSERT_EXPR for bit-field stores. */ /* Turn MEM_REF into BIT_INSERT_EXPR for bit-field stores. */
......
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> 2018-07-12 Richard Biener <rguenther@suse.de>
PR c/86453 PR c/86453
......
/* 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;
}
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