diff options
author | Jan Hubicka <jh@suse.cz> | 2013-09-06 12:13:37 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-09-06 10:13:37 +0000 |
commit | fc11f321bbffb92287ee4f25aa70eab40f66a163 (patch) | |
tree | e167b438c335f3bc2a8367366839e99f406f78e4 /gcc/symtab.c | |
parent | 9a6af4504b8bc9b03020b1e96a3bad56d9929916 (diff) | |
download | gcc-fc11f321bbffb92287ee4f25aa70eab40f66a163.zip gcc-fc11f321bbffb92287ee4f25aa70eab40f66a163.tar.gz gcc-fc11f321bbffb92287ee4f25aa70eab40f66a163.tar.bz2 |
re PR middle-end/58094 (IPA devirt testsuite errors)
PR middle-end/58094
* cgraph.h (symtab_semantically_equivalent_p): Declare.
* tree-tailcall.c: Include ipa-utils.h.
(find_tail_calls): Use it.
* ipa-pure-const.c (check_call): Likewise.
* ipa-utils.c (recursive_call_p): New function.
* ipa-utils.h (recursive_call_p): Dclare.
* symtab.c (symtab_nonoverwritable_alias): Fix formatting.
(symtab_semantically_equivalent_p): New function.
* Makefile.in (tree-tailcall.o): Update dependencies.
From-SVN: r202316
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index 253ba98..8dc61d0 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1106,11 +1106,48 @@ symtab_nonoverwritable_alias (symtab_node node) { DECL_STATIC_CONSTRUCTOR (new_decl) = 0; DECL_STATIC_DESTRUCTOR (new_decl) = 0; - new_node = (symtab_node) cgraph_create_function_alias (new_decl, node->symbol.decl); + new_node = (symtab_node) cgraph_create_function_alias + (new_decl, node->symbol.decl); } else - new_node = (symtab_node) varpool_create_variable_alias (new_decl, node->symbol.decl); + new_node = (symtab_node) varpool_create_variable_alias (new_decl, + node->symbol.decl); symtab_resolve_alias (new_node, node); + gcc_assert (decl_binds_to_current_def_p (new_decl)); return new_node; } + +/* Return true if A and B represents semantically equivalent symbols. */ + +bool +symtab_semantically_equivalent_p (symtab_node a, + symtab_node b) +{ + enum availability avail; + symtab_node ba, bb; + + /* Equivalent functions are equivalent. */ + if (a->symbol.decl == b->symbol.decl) + return true; + + /* If symbol is not overwritable by different implementation, + walk to the base object it defines. */ + ba = symtab_alias_ultimate_target (a, &avail); + if (avail >= AVAIL_AVAILABLE) + { + if (ba == b) + return true; + } + else + ba = a; + bb = symtab_alias_ultimate_target (b, &avail); + if (avail >= AVAIL_AVAILABLE) + { + if (a == bb) + return true; + } + else + bb = b; + return bb == ba; +} #include "gt-symtab.h" |