diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-20 13:26:19 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-20 13:26:19 +0000 |
commit | d205f2193d009a274a9d59daf12f822da4d03e3e (patch) | |
tree | af742886d1ebe018b2c605867c7bda3ec915fc88 | |
parent | 420bd93adacd192ec927fa895d374855a190e7eb (diff) | |
download | gcc-d205f2193d009a274a9d59daf12f822da4d03e3e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219892 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-reference.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr64684_0.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr64684_1.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr64684_2.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr64685_0.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr64685_1.c | 27 |
8 files changed, 100 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ad6b9d6bfb..763f105f6ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2015-01-20 Matthew Wahab <matthew.wahab@arm.com> PR target/64149 diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 6a677ca502c..5f43a02a1e1 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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3af24f4255c..1049e672c0f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-01-20 Richard Biener <rguenther@suse.de> + + PR ipa/64684 + * 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. + 2015-01-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/62241 diff --git a/gcc/testsuite/gcc.dg/lto/pr64684_0.c b/gcc/testsuite/gcc.dg/lto/pr64684_0.c new file mode 100644 index 00000000000..89883504d20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64684_0.c @@ -0,0 +1,13 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { { -O1 -flto } } } */ + +extern void fn2 (void); +extern int a; + +void +fn1 () +{ + a = -1; + fn2 (); + a &= 1; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64684_1.c b/gcc/testsuite/gcc.dg/lto/pr64684_1.c new file mode 100644 index 00000000000..f65af2dcf8b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64684_1.c @@ -0,0 +1,9 @@ +/* { dg-options "-Os" } */ + +extern int a; + +void +fn2 (void) +{ + a = 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64684_2.c b/gcc/testsuite/gcc.dg/lto/pr64684_2.c new file mode 100644 index 00000000000..fe077c313cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64684_2.c @@ -0,0 +1,16 @@ +/* { dg-options "-O0" } */ + +extern void fn1 (void); + +int a; + +int +main () +{ + fn1 (); + + if (a != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64685_0.c b/gcc/testsuite/gcc.dg/lto/pr64685_0.c new file mode 100644 index 00000000000..6ebc9eaa163 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64685_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { { -flto } } } */ + +extern int b; + +void +fn1 (void) +{ + b = 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64685_1.c b/gcc/testsuite/gcc.dg/lto/pr64685_1.c new file mode 100644 index 00000000000..38022d31d83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64685_1.c @@ -0,0 +1,27 @@ +/* { dg-options "-O1" } */ + +extern void fn1 (void); + +int a[2], b; + +static void +foo (int p) +{ + b = 1 ^ a[(b ^ 1) & 1]; + b = 1 ^ a[b & 1]; + if (p) + __builtin_abort (); +} + +int +main () +{ + foo (0); + b = 0; + foo (0); + + if (b != 1) + __builtin_abort (); + + return 0; +} |