diff options
author | Martin Liska <mliska@suse.cz> | 2017-01-20 09:44:35 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-01-20 08:44:35 +0000 |
commit | 2d8d3ae29381d13789fa5fa349ec5c302b921aac (patch) | |
tree | 79ae1578993b051576a1c049cc48e85c5e63a05d /gcc/symtab.c | |
parent | a809d56440d84fd363aa542a37d69275fd2930c5 (diff) | |
download | gcc-2d8d3ae29381d13789fa5fa349ec5c302b921aac.zip gcc-2d8d3ae29381d13789fa5fa349ec5c302b921aac.tar.gz gcc-2d8d3ae29381d13789fa5fa349ec5c302b921aac.tar.bz2 |
Fix IPA CP where it forgot to add a reference in cgraph (PR ipa/71190).
2017-01-20 Martin Liska <mliska@suse.cz>
PR ipa/71190
* cgraph.h (maybe_create_reference): Remove argument and
update comment.
* cgraphclones.c (cgraph_node::create_virtual_clone): Remove one
argument.
* ipa-cp.c (create_specialized_node): Likewise.
* symtab.c (symtab_node::maybe_create_reference): Handle
VAR_DECLs and ADDR_EXPRs and select ipa_ref_use type.
From-SVN: r244687
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index ba395cd..87febdc 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -588,18 +588,25 @@ symtab_node::create_reference (symtab_node *referred_node, return ref; } -/* If VAL is a reference to a function or a variable, add a reference from - this symtab_node to the corresponding symbol table node. USE_TYPE specify - type of the use and STMT the statement (if it exists). Return the new - reference or NULL if none was created. */ - ipa_ref * -symtab_node::maybe_create_reference (tree val, enum ipa_ref_use use_type, - gimple *stmt) +symtab_node::maybe_create_reference (tree val, gimple *stmt) { STRIP_NOPS (val); - if (TREE_CODE (val) != ADDR_EXPR) - return NULL; + ipa_ref_use use_type; + + switch (TREE_CODE (val)) + { + case VAR_DECL: + use_type = IPA_REF_LOAD; + break; + case ADDR_EXPR: + use_type = IPA_REF_ADDR; + break; + default: + gcc_assert (!handled_component_p (val)); + return NULL; + } + val = get_base_var (val); if (val && VAR_OR_FUNCTION_DECL_P (val)) { |