Commit e3e6cff4 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/38745 (ICE: statement makes a memory store, but has no VDEFS)

2009-01-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/38745
	* tree-ssa.c (execute_update_addresses_taken): Do not include
	variables that cannot possibly be a register in not_reg_needs.
	Do not clear TREE_ADDRESSABLE on vars that may not become
	registers.
	* tree-ssa.c (update_alias_info_1): Include those in the set
	of addressable vars.

	* g++.dg/torture/pr38745.C: New testcase.

From-SVN: r143673
parent dc874b53
2009-01-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38745
* tree-ssa.c (execute_update_addresses_taken): Do not include
variables that cannot possibly be a register in not_reg_needs.
Do not clear TREE_ADDRESSABLE on vars that may not become
registers.
* tree-ssa.c (update_alias_info_1): Include those in the set
of addressable vars.
2009-01-26 Richard Guenther <rguenther@suse.de>
PR middle-end/38851
* Makefile.in (tree-ssa-dse.o): Add langhooks.h.
* tree-ssa-dse.c: Include langhooks.h
......
2009-01-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38745
* g++.dg/torture/pr38745.C: New testcase.
2009-01-26 Richard Guenther <rguenther@suse.de>
PR middle-end/38851
* g++.dg/warn/Wuninitialized-1.C: New testcase.
......
/* { dg-do compile } */
union u_u16
{
unsigned short v;
struct
{
unsigned char lo8, hi8;
} __attribute__ ((__may_alias__)) u;
} __attribute__ ((__may_alias__));
union u_u32
{
unsigned int v;
struct
{
u_u16 lo16, hi16;
} u;
} __attribute__ ((__may_alias__));
union u_u64
{
struct
{
u_u32 lo32, hi32;
} u;
};
struct Record
{
};
long long
UnpackFullKey (Record & rec, const char *&p)
{
long long c64 = 0;
(*(u_u16 *) & (*(u_u32 *) & ( *(u_u64*)&c64).u.lo32.v).u.lo16.v).u.hi8 = 1;
return c64;
}
......@@ -2483,6 +2483,22 @@ update_alias_info_1 (gimple stmt, struct alias_info *ai)
if (addr_taken)
bitmap_ior_into (gimple_addressable_vars (cfun), addr_taken);
/* If we have a call or an assignment, see if the lhs contains
a local decl that requires not to be a gimple register. */
if (gimple_code (stmt) == GIMPLE_ASSIGN
|| gimple_code (stmt) == GIMPLE_CALL)
{
tree lhs = gimple_get_lhs (stmt);
/* A plain decl does not need it set. */
if (lhs && handled_component_p (lhs))
{
tree var = get_base_address (lhs);
if (DECL_P (var)
&& is_gimple_reg_type (TREE_TYPE (var)))
bitmap_set_bit (gimple_addressable_vars (cfun), DECL_UID (var));
}
}
/* Process each operand use. For pointers, determine whether they
are dereferenced by the statement, or whether their value
escapes, etc. */
......
......@@ -1731,7 +1731,12 @@ execute_update_addresses_taken (void)
|| bitmap_bit_p (addresses_taken, DECL_UID (var)))
continue;
if (TREE_ADDRESSABLE (var))
if (TREE_ADDRESSABLE (var)
/* Do not change TREE_ADDRESSABLE if we need to preserve var as
a non-register. Otherwise we are confused and forget to
add virtual operands for it. */
&& (!is_gimple_reg_type (TREE_TYPE (var))
|| !bitmap_bit_p (not_reg_needs, DECL_UID (var))))
{
TREE_ADDRESSABLE (var) = 0;
if (is_gimple_reg (var))
......
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