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
This commit is contained in:
Richard Guenther 2006-06-15 17:23:41 +00:00 committed by Richard Biener
parent 11f7dd15f1
commit 5d35c1715c
5 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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;

View File

@ -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.

View File

@ -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" } } */