diff options
author | Jan Hubicka <jh@suse.cz> | 2013-09-16 13:47:48 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-09-16 11:47:48 +0000 |
commit | 1632a686734571d8bfb126857b415389b5d07a56 (patch) | |
tree | 057bdf48e7cbcbd0d6da68e1404286f06fab3e77 /gcc | |
parent | 828e70c1d7bb5c849a2df44aa832793c71833058 (diff) | |
download | gcc-1632a686734571d8bfb126857b415389b5d07a56.zip gcc-1632a686734571d8bfb126857b415389b5d07a56.tar.gz gcc-1632a686734571d8bfb126857b415389b5d07a56.tar.bz2 |
gimple-fold.c (can_refer_decl_in_current_unit_p): Do not accept abstract functions; for static functions check the presence of body.
* gimple-fold.c (can_refer_decl_in_current_unit_p): Do not accept
abstract functions; for static functions check the presence
of body.
From-SVN: r202626
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 22 |
2 files changed, 24 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68091bb..b9a335a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-16 Jan Hubicka <jh@suse.cz> + + * gimple-fold.c (can_refer_decl_in_current_unit_p): Do not accept + abstract functions; for static functions check the presence + of body. + 2013-09-16 James Greenhalgh <james.greenhalgh@arm.com> * config/aarch64/aarch64-simd-builtins.def (fma): New. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 98c3a15..51713e6 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -60,6 +60,24 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) struct cgraph_node *node; symtab_node snode; + if (DECL_ABSTRACT (decl)) + return false; + + /* We are concerned only about static/external vars and functions. */ + if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) + || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)) + return true; + + /* Static objects can be referred only if they was not optimized out yet. */ + if (!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl)) + { + snode = symtab_get_node (decl); + if (!snode) + return false; + node = dyn_cast <cgraph_node> (snode); + return !node || !node->global.inlined_to; + } + /* We will later output the initializer, so we can refer to it. So we are concerned only when DECL comes from initializer of external var. */ @@ -69,10 +87,6 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl) || (flag_ltrans && symtab_get_node (from_decl)->symbol.in_other_partition)) return true; - /* We are concerned only about static/external vars and functions. */ - if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) - || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)) - return true; /* We are folding reference from external vtable. The vtable may reffer to a symbol keyed to other compilation unit. The other compilation unit may be in separate DSO and the symbol may be hidden. */ |