diff options
author | Richard Biener <rguenther@suse.de> | 2015-01-20 13:26:19 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-01-20 13:26:19 +0000 |
commit | 2fd2ae3458ca760040ddb65a45f45fb2e89f2779 (patch) | |
tree | af742886d1ebe018b2c605867c7bda3ec915fc88 /gcc/ipa-reference.c | |
parent | 7d56e747e271356ccaecfa2adbf2516c0c316649 (diff) | |
download | gcc-2fd2ae3458ca760040ddb65a45f45fb2e89f2779.zip gcc-2fd2ae3458ca760040ddb65a45f45fb2e89f2779.tar.gz gcc-2fd2ae3458ca760040ddb65a45f45fb2e89f2779.tar.bz2 |
re PR lto/64684 (wrong code by LTO on x86_64-linux-gnu)
2015-01-20 Richard Biener <rguenther@suse.de>
PR ipa/64684
* ipa-reference.c (add_static_var): Inline ...
(analyze_function): ... here after splitting out from ...
(is_proper_for_analysis): ... this.
* gcc.dg/lto/pr64684_0.c: New testcase.
* gcc.dg/lto/pr64684_1.c: Likewise.
* gcc.dg/lto/pr64684_2.c: Likewise.
* gcc.dg/lto/pr64685_0.c: Likewise.
* gcc.dg/lto/pr64685_1.c: Likewise.
From-SVN: r219892
Diffstat (limited to 'gcc/ipa-reference.c')
-rw-r--r-- | gcc/ipa-reference.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 6a677ca..5f43a02 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -236,21 +236,6 @@ ipa_reference_get_not_written_global (struct cgraph_node *fn) } - -/* Add VAR to all_module_statics and the two - reference_vars_to_consider* sets. */ - -static inline void -add_static_var (tree var) -{ - int uid = DECL_UID (var); - gcc_assert (TREE_CODE (var) == VAR_DECL); - if (dump_file) - splay_tree_insert (reference_vars_to_consider, - uid, (splay_tree_value)var); - bitmap_set_bit (all_module_statics, uid); -} - /* Return true if the variable T is the right kind of static variable to perform compilation unit scope escape analysis. */ @@ -285,12 +270,6 @@ is_proper_for_analysis (tree t) if (bitmap_bit_p (ignore_module_statics, DECL_UID (t))) return false; - /* This is a variable we care about. Check if we have seen it - before, and if not add it the set of variables we care about. */ - if (all_module_statics - && !bitmap_bit_p (all_module_statics, DECL_UID (t))) - add_static_var (t); - return true; } @@ -497,6 +476,15 @@ analyze_function (struct cgraph_node *fn) var = ref->referred->decl; if (!is_proper_for_analysis (var)) continue; + /* This is a variable we care about. Check if we have seen it + before, and if not add it the set of variables we care about. */ + if (all_module_statics + && bitmap_set_bit (all_module_statics, DECL_UID (var))) + { + if (dump_file) + splay_tree_insert (reference_vars_to_consider, + DECL_UID (var), (splay_tree_value)var); + } switch (ref->use) { case IPA_REF_LOAD: |