From: Jan Hubicka Date: Mon, 1 Mar 2021 13:36:11 +0000 (+0100) Subject: Fix ICE in compute_fn_summary X-Git-Tag: releases/gcc-10.3.0~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62125ef043e19c58780bc06d0e2f2221bbbf28f6;p=thirdparty%2Fgcc.git Fix ICE in compute_fn_summary PR ipa/98338 * ipa-fnsummary.c (compute_fn_summary): Fix sanity check. (cherry picked from commit 150bde36c119eff4b8a74667c9d728d6a8a5e8a1) --- diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index e07c9b3bba01..1105f6ae5c2c 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -2986,11 +2986,18 @@ compute_fn_summary (struct cgraph_node *node, bool early) info->estimated_stack_size = size_info->estimated_self_stack_size; /* Code above should compute exactly the same result as - ipa_update_overall_fn_summary but because computation happens in - different order the roundoff errors result in slight changes. */ + ipa_update_overall_fn_summary except for case when speculative + edges are present since these are accounted to size but not + self_size. Do not compare time since different order the roundoff + errors result in slight changes. */ ipa_update_overall_fn_summary (node); - /* In LTO mode we may have speculative edges set. */ - gcc_assert (in_lto_p || size_info->size == size_info->self_size); + if (flag_checking) + { + for (e = node->indirect_calls; e; e = e->next_callee) + if (e->speculative) + break; + gcc_assert (e || size_info->size == size_info->self_size); + } }