diff options
author | Richard Guenther <rguenther@suse.de> | 2006-06-15 17:23:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-06-15 17:23:41 +0000 |
commit | 5d35c1715c44c574a5d75bac53c97a1ecfbc949a (patch) | |
tree | bf71461032c06919367509fa737fb0306b9ff826 /gcc | |
parent | 11f7dd15f1893b04b07965f7cc8a6bfa9459ac9b (diff) | |
download | gcc-5d35c1715c44c574a5d75bac53c97a1ecfbc949a.zip gcc-5d35c1715c44c574a5d75bac53c97a1ecfbc949a.tar.gz gcc-5d35c1715c44c574a5d75bac53c97a1ecfbc949a.tar.bz2 |
re PR middle-end/27781 (weak-attribute over-optimisation)
2006-06-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27781
* Makefile.in (ipa-pure-const.o): Add $(TARGET_H) dependency.
* ipa-pure-const.c (target.h): Include.
(analyze_function): Do not analyze functions that do not
bind locally.
* gcc.dg/tree-ssa/pr27781.c: New testcase.
From-SVN: r114681
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr27781.c | 17 |
5 files changed, 37 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9abc3e8..3fffbff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-06-16 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/27781 + * Makefile.in (ipa-pure-const.o): Add $(TARGET_H) dependency. + * ipa-pure-const.c (target.h): Include. + (analyze_function): Do not analyze functions that do not + bind locally. + 2006-06-15 Andrew MacLeod <amacleod@redhat.com> PR middle-end/27793 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e358be7..4ffbd55 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2309,7 +2309,7 @@ ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \ $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(DIAGNOSTIC_H) ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ - pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(C_COMMON_H) \ + pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(C_COMMON_H) $(TARGET_H) \ $(TREE_GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) tree-pass.h $(DIAGNOSTIC_H) ipa-type-escape.o : ipa-type-escape.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \ diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 079af5e..041cf29 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -51,6 +51,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "timevar.h" #include "diagnostic.h" #include "langhooks.h" +#include "target.h" static struct pointer_set_t *visited_nodes; @@ -499,9 +500,11 @@ analyze_function (struct cgraph_node *fn) l->pure_const_state = IPA_CONST; l->state_set_in_source = false; - /* If this is a volatile function, do not touch this unless it has - been marked as const or pure by the front end. */ - if (TREE_THIS_VOLATILE (decl)) + /* If this function does not return normally or does not bind local, + do not touch this unless it has been marked as const or pure by the + front end. */ + if (TREE_THIS_VOLATILE (decl) + || !targetm.binds_local_p (decl)) { l->pure_const_state = IPA_NEITHER; return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c538d13..6570fe1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-06-16 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/27781 + * gcc.dg/tree-ssa/pr27781.c: New testcase. + 2006-06-15 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.dg/allocate_zerosize_2.f90: New test case. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr27781.c b/gcc/testsuite/gcc.dg/tree-ssa/pr27781.c new file mode 100644 index 0000000..0e1a02a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr27781.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +void __attribute__((weak)) func(void) +{ + /* no code */ +} + +int main() +{ + func(); + return 0; +} + +/* { dg-final { scan-tree-dump "func \\(\\);" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |