re PR tree-optimization/45945 (ICE: verify_ssa failed: error: SSA_NAME_DEF_STMT is wrong when using inline ASM with -flto/-fwhopr)

2010-10-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45945
	* tree-ssa.c (execute_update_addresses_taken): Fixup LHS
	scanning.

	* gcc.dg/lto/20101009-1_0.c: New testcase.

From-SVN: r165222
This commit is contained in:
Richard Guenther 2010-10-09 12:45:09 +00:00 committed by Richard Biener
parent 1802378d26
commit e5160e93fd
4 changed files with 55 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2010-10-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45945
* tree-ssa.c (execute_update_addresses_taken): Fixup LHS
scanning.
2010-10-09 Eric Botcazou <ebotcazou@adacore.com>
PR tree-optimization/45612

View File

@ -1,3 +1,8 @@
2010-10-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45945
* gcc.dg/lto/20101009-1_0.c: New testcase.
2010-10-08 H.J. Lu <hongjiu.lu@intel.com>
PR target/45913

View File

@ -0,0 +1,16 @@
/* { dg-lto-do link } */
static inline void
bar (unsigned *u)
{
__asm__ ("":"=d" (*u));
}
void
foo (void)
{
int i;
bar (&i);
}
int main() { return 0; }

View File

@ -1980,8 +1980,10 @@ execute_update_addresses_taken (void)
/* A plain decl does not need it set. */
if (lhs && !DECL_P (lhs))
{
if (handled_component_p (lhs))
lhs = get_base_address (lhs);
tree orig_lhs = lhs;
while (handled_component_p (lhs))
lhs = TREE_OPERAND (lhs, 0);
if (DECL_P (lhs))
bitmap_set_bit (not_reg_needs, DECL_UID (lhs));
@ -1992,7 +1994,7 @@ execute_update_addresses_taken (void)
if (DECL_P (decl)
&& (!integer_zerop (TREE_OPERAND (lhs, 1))
|| (DECL_SIZE (decl)
!= TYPE_SIZE (TREE_TYPE (lhs)))))
!= TYPE_SIZE (TREE_TYPE (orig_lhs)))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
@ -2020,8 +2022,29 @@ execute_update_addresses_taken (void)
for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
{
tree link = gimple_asm_output_op (stmt, i);
if ((decl = non_rewritable_mem_ref_base (TREE_VALUE (link))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
tree lhs = TREE_VALUE (link);
/* A plain decl does not need it set. */
if (!DECL_P (lhs))
{
tree orig_lhs = lhs;
while (handled_component_p (lhs))
lhs = TREE_OPERAND (lhs, 0);
if (DECL_P (lhs))
bitmap_set_bit (not_reg_needs, DECL_UID (lhs));
else if (TREE_CODE (lhs) == MEM_REF
&& TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR)
{
decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0);
if (DECL_P (decl)
&& (!integer_zerop (TREE_OPERAND (lhs, 1))
|| (TYPE_MAIN_VARIANT (TREE_TYPE (decl))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_lhs)))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
}
for (i = 0; i < gimple_asm_ninputs (stmt); ++i)
{