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]

[PR bootstrap/51346] Fix lto profiledbootstrap (issue5437103)


These two patches fix the profiledbootstrap failure I caused earlier
this week.

The first patch reverts my original fix.  The second one implements a
different approach for this problem.  Instead of trying to keep the
edge attribute in sync with the statement, we do not use the edge
attribute as long as there is a statement on that edge.

This is still sub-optimal.  We should only have a single no-inline
attribute.  Given that we sometimes have a callgraph without code, the
attribute should be on the edge.  Honza how hard would it be to
implement that?

In addition to fixing my internal build failure and the bootstrap,
this fixes two tests:

g++.dg/lto/20101020-1
gcc.c-torture/execute/920501-1.c


Tested on x86_64 with profiledbootstrap.  Committed to trunk.


Diego.

	PR bootstrap/51346
	Revert
	2011-11-29   Diego Novillo  <dnovillo@google.com>

		* gimple.c (gimple_call_set_cannot_inline): Move from gimple.h.
		Update field call_stmt_cannot_inline_p from call
		graph edge, if needed.
		* gimple.h (gimple_call_set_cannot_inline): Move to gimple.c.


	PR bootstrap/51346
	* ipa-inline.c (can_inline_edge_p): If the edge E has a
 	statement, use the statement's inline indicator instead
 	of E's.
 	Remove consistency check.


diff --git a/gcc/gimple.c b/gcc/gimple.c
index d27e94b..071c651 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -5558,34 +5558,4 @@ gimple_asm_clobbers_memory_p (const_gimple stmt)
 
   return false;
 }
-
-
-/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P.  */
-
-void
-gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
-{
-  bool prev_inlinable_p;
-
-  GIMPLE_CHECK (s, GIMPLE_CALL);
-
-  prev_inlinable_p = gimple_call_cannot_inline_p (s);
-
-  if (inlinable_p)
-    s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
-  else
-    s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
-
-  /* If we have changed the inlinable attribute, and there is a call
-     graph edge going out of this statement, update its inlinable
-     attribute as well.  */
-  if (current_function_decl && prev_inlinable_p != inlinable_p)
-    {
-      struct cgraph_node *n = cgraph_get_node (current_function_decl);
-      struct cgraph_edge *e = cgraph_edge (n, s);
-      if (e)
-	e->call_stmt_cannot_inline_p = inlinable_p;
-    }
-}
-
 #include "gt-gimple.h"
diff --git a/gcc/gimple.h b/gcc/gimple.h
index df31bf3..8536c70 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1035,7 +1035,6 @@ extern bool walk_stmt_load_store_ops (gimple, void *,
 extern bool gimple_ior_addresses_taken (bitmap, gimple);
 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
 extern bool gimple_asm_clobbers_memory_p (const_gimple);
-extern void gimple_call_set_cannot_inline (gimple, bool);
 
 /* In gimplify.c  */
 extern tree create_tmp_var_raw (tree, const char *);
@@ -2344,6 +2343,19 @@ gimple_call_tail_p (gimple s)
 }
 
 
+/* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P.  */
+
+static inline void
+gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
+{
+  GIMPLE_CHECK (s, GIMPLE_CALL);
+  if (inlinable_p)
+    s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
+  else
+    s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
+}
+
+
 /* Return true if GIMPLE_CALL S cannot be inlined.  */
 
 static inline bool
-- 
1.7.3.1



diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 3dadf8d..e3c6b3c 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -246,6 +246,14 @@ can_inline_edge_p (struct cgraph_edge *e, bool report)
   struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl);
   struct function *callee_cfun
     = callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL;
+  bool call_stmt_cannot_inline_p;
+
+  /* If E has a call statement in it, use the inline attribute from
+     the statement, otherwise use the inline attribute in E.  Edges
+     will not have statements when working in WPA mode.  */
+  call_stmt_cannot_inline_p = (e->call_stmt)
+			      ? gimple_call_cannot_inline_p (e->call_stmt)
+			      : e->call_stmt_cannot_inline_p;
 
   if (!caller_cfun && e->caller->clone_of)
     caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl);
@@ -270,7 +278,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report)
       e->inline_failed = CIF_OVERWRITABLE;
       return false;
     }
-  else if (e->call_stmt_cannot_inline_p)
+  else if (call_stmt_cannot_inline_p)
     {
       e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
       inlinable = false;
@@ -343,14 +351,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report)
 	}
     }
 
-  /* Be sure that the cannot_inline_p flag is up to date.  */
-  gcc_checking_assert (!e->call_stmt
-		       || (gimple_call_cannot_inline_p (e->call_stmt)
-		           == e->call_stmt_cannot_inline_p)
-		       /* In -flto-partition=none mode we really keep things out of
-			  sync because call_stmt_cannot_inline_p is set at cgraph
-			  merging when function bodies are not there yet.  */
-		       || (in_lto_p && !gimple_call_cannot_inline_p (e->call_stmt)));
   if (!inlinable && report)
     report_inline_failed_reason (e);
   return inlinable;
-- 
1.7.3.1

--
This patch is available for review at http://codereview.appspot.com/5437103


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