Commit 4c7d0777 by Teresa Johnson Committed by Teresa Johnson

re PR ipa/58862 (LTO profiledbootstrap failure: lto1: ICE in edge_badness, at ipa-inline.c:1008)

2013-11-13  Teresa Johnson  <tejohnson@google.com>

	PR ipa/58862
	* predict.c (drop_profile): Error is currently too strict.
	(handle_missing_profiles): Pass call_count to drop_profile.

From-SVN: r204756
parent 51f5c118
2013-11-13 Teresa Johnson <tejohnson@google.com> 2013-11-13 Teresa Johnson <tejohnson@google.com>
PR ipa/58862 PR ipa/58862
* predict.c (drop_profile): Error is currently too strict.
(handle_missing_profiles): Pass call_count to drop_profile.
2013-11-13 Teresa Johnson <tejohnson@google.com>
PR ipa/58862
* ipa-inline.c (edge_badness): Fix overflow. * ipa-inline.c (edge_badness): Fix overflow.
2013-11-13 Vladimir Makarov <vmakarov@redhat.com> 2013-11-13 Vladimir Makarov <vmakarov@redhat.com>
...@@ -2766,12 +2766,17 @@ estimate_loops (void) ...@@ -2766,12 +2766,17 @@ estimate_loops (void)
} }
/* Drop the profile for NODE to guessed, and update its frequency based on /* Drop the profile for NODE to guessed, and update its frequency based on
whether it is expected to be HOT. */ whether it is expected to be hot given the CALL_COUNT. */
static void static void
drop_profile (struct cgraph_node *node, bool hot) drop_profile (struct cgraph_node *node, gcov_type call_count)
{ {
struct function *fn = DECL_STRUCT_FUNCTION (node->decl); struct function *fn = DECL_STRUCT_FUNCTION (node->decl);
/* In the case where this was called by another function with a
dropped profile, call_count will be 0. Since there are no
non-zero call counts to this function, we don't know for sure
whether it is hot, and therefore it will be marked normal below. */
bool hot = maybe_hot_count_p (NULL, call_count);
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
...@@ -2781,8 +2786,13 @@ drop_profile (struct cgraph_node *node, bool hot) ...@@ -2781,8 +2786,13 @@ drop_profile (struct cgraph_node *node, bool hot)
/* We only expect to miss profiles for functions that are reached /* We only expect to miss profiles for functions that are reached
via non-zero call edges in cases where the function may have via non-zero call edges in cases where the function may have
been linked from another module or library (COMDATs and extern been linked from another module or library (COMDATs and extern
templates). See the comments below for handle_missing_profiles. */ templates). See the comments below for handle_missing_profiles.
if (!DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl)) Also, only warn in cases where the missing counts exceed the
number of training runs. In certain cases with an execv followed
by a no-return call the profile for the no-return call is not
dumped and there can be a mismatch. */
if (!DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl)
&& call_count > profile_info->runs)
{ {
if (flag_profile_correction) if (flag_profile_correction)
{ {
...@@ -2792,7 +2802,7 @@ drop_profile (struct cgraph_node *node, bool hot) ...@@ -2792,7 +2802,7 @@ drop_profile (struct cgraph_node *node, bool hot)
cgraph_node_name (node), node->order); cgraph_node_name (node), node->order);
} }
else else
error ("Missing counts for called function %s/%i", warning (0, "Missing counts for called function %s/%i",
cgraph_node_name (node), node->order); cgraph_node_name (node), node->order);
} }
...@@ -2839,9 +2849,7 @@ handle_missing_profiles (void) ...@@ -2839,9 +2849,7 @@ handle_missing_profiles (void)
&& fn && fn->cfg && fn && fn->cfg
&& (call_count * unlikely_count_fraction >= profile_info->runs)) && (call_count * unlikely_count_fraction >= profile_info->runs))
{ {
bool maybe_hot = maybe_hot_count_p (NULL, call_count); drop_profile (node, call_count);
drop_profile (node, maybe_hot);
worklist.safe_push (node); worklist.safe_push (node);
} }
} }
...@@ -2863,11 +2871,7 @@ handle_missing_profiles (void) ...@@ -2863,11 +2871,7 @@ handle_missing_profiles (void)
if (DECL_COMDAT (callee->decl) && fn && fn->cfg if (DECL_COMDAT (callee->decl) && fn && fn->cfg
&& profile_status_for_function (fn) == PROFILE_READ) && profile_status_for_function (fn) == PROFILE_READ)
{ {
/* Since there are no non-0 call counts to this function, drop_profile (node, 0);
we don't know for sure whether it is hot. Indicate to
the drop_profile routine that function should be marked
normal, rather than hot. */
drop_profile (node, false);
worklist.safe_push (callee); worklist.safe_push (callee);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment