This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH PR 43061: check DECL_PRESERVE_P in the midend


This fixes 245 failures in the objective-c testsuite for me. The interesting question is, should we also remove the || lookup_attribute ("used", DECL_ATTRIBUTES (decl) part? My first guess, would be no, other frontends might only set the attribute and not DECL_PRESERVE_P.

Ok?

$ cat ~/diffs/ipa.diffs
2010-02-18  Mike Stump  <mikestump@comcast.net>

	PR objc/43061
	* cgraphunit.c (process_function_and_variable_attributes): Check
	DECL_PRESERVE_P as well.
	* ipa-pure-const.c (check_decl): Likewise.
	* ipa-reference.c (has_proper_scope_for_analysis): Likewise.
	* ipa-type-escape.c (has_proper_scope_for_analysis): Likewise.

Doing diffs in .:
--- cgraphunit.c.~1~	2010-02-15 17:16:39.000000000 -0800
+++ cgraphunit.c	2010-02-18 12:32:35.000000000 -0800
@@ -885,7 +885,8 @@ process_function_and_variable_attributes
   for (node = cgraph_nodes; node != first; node = node->next)
     {
       tree decl = node->decl;
-      if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
+      if (DECL_PRESERVE_P (decl)
+	  || lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
 	{
 	  mark_decl_referenced (decl);
 	  if (node->local.finalized)
@@ -904,7 +905,8 @@ process_function_and_variable_attributes
   for (vnode = varpool_nodes; vnode != first_var; vnode = vnode->next)
     {
       tree decl = vnode->decl;
-      if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
+      if (DECL_PRESERVE_P (decl)
+	  || lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
 	{
 	  mark_decl_referenced (decl);
 	  vnode->force_output = true;
--- ipa-pure-const.c.~1~	2010-01-27 07:39:41.000000000 -0800
+++ ipa-pure-const.c	2010-02-18 12:33:03.000000000 -0800
@@ -159,7 +159,7 @@ check_decl (funct_state local,

/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t) || lookup_attribute ("used", DECL_ATTRIBUTES (t)))
{
local->pure_const_state = IPA_NEITHER;
if (dump_file)
--- ipa-reference.c.~1~ 2010-01-27 07:33:40.000000000 -0800
+++ ipa-reference.c 2010-02-18 12:33:58.000000000 -0800
@@ -306,7 +306,7 @@ has_proper_scope_for_analysis (tree t)
{
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t) || lookup_attribute ("used", DECL_ATTRIBUTES (t)))
return false;


   /* Do not want to do anything with volatile except mark any
--- ipa-type-escape.c.~1~	2010-01-27 07:39:44.000000000 -0800
+++ ipa-type-escape.c	2010-02-18 12:36:49.000000000 -0800
@@ -1072,7 +1072,7 @@ has_proper_scope_for_analysis (tree t)
   tree type = get_canon_type (TREE_TYPE (t), false, false);
   if (!type) return;

- if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+ if (DECL_PRESERVE_P (t) || lookup_attribute ("used", DECL_ATTRIBUTES (t)))
{
mark_interesting_type (type, FULL_ESCAPE);
return;
--------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]