diff options
author | Richard Guenther <rguenther@suse.de> | 2010-10-09 12:45:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-10-09 12:45:09 +0000 |
commit | e5160e93fde5752e5a7fb5c18fa5bf75dcbad3e8 (patch) | |
tree | 51ab23b2b7caced5ac3707964387a2997ee23514 /gcc/tree-ssa.c | |
parent | 1802378d26bfd8dcc519ed441549af48f6c756a6 (diff) | |
download | gcc-e5160e93fde5752e5a7fb5c18fa5bf75dcbad3e8.tar.gz |
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
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 0b83b37e02f..e5acbf4cedb 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -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) { |