aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-12 20:31:04 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-12 19:31:04 +0000
commitd200a49f5c83fa0f2e7332aecf69b6ab4a51b052 (patch)
tree08a1dc9c03274e22ed1b88ba948c5682c9589934
parent1cf83d35b8cc41e88504b38e7f4d182ee1476003 (diff)
downloadgcc-d200a49f5c83fa0f2e7332aecf69b6ab4a51b052.zip
gcc-d200a49f5c83fa0f2e7332aecf69b6ab4a51b052.tar.gz
gcc-d200a49f5c83fa0f2e7332aecf69b6ab4a51b052.tar.bz2
re PR ipa/92471 ([ICE] lto1 segmentation fault: ipa-profile.c ipa_get_cs_argument_count (args=0x0))
PR ipa/92471 * ipa-profile.c (check_argument_count): Break out from ...; watch for missing summaries. (ipa_profile): Here. From-SVN: r278100
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa-profile.c30
2 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a434f25..5cd93c6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-12 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/92471
+ * ipa-profile.c (check_argument_count): Break out from ...;
+ watch for missing summaries.
+ (ipa_profile): Here.
+
2019-11-12 Martin Sebor <msebor@redhat.com>
PR tree-optimization/92412
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index 7bf4466..cd354d1 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -476,6 +476,27 @@ ipa_propagate_frequency (struct cgraph_node *node)
return changed;
}
+/* Check that number of arguments of N agrees with E.
+ Be conservative when summaries are not present. */
+
+static bool
+check_argument_count (struct cgraph_node *n, struct cgraph_edge *e)
+{
+ if (!ipa_node_params_sum || !ipa_edge_args_sum)
+ return true;
+ class ipa_node_params *info = IPA_NODE_REF (n->function_symbol ());
+ if (!info)
+ return true;
+ ipa_edge_args *e_info = IPA_EDGE_REF (e);
+ if (!e)
+ return true;
+ if (ipa_get_param_count (info) != ipa_get_cs_argument_count (e_info)
+ && (ipa_get_param_count (info) >= ipa_get_cs_argument_count (e_info)
+ || !stdarg_p (TREE_TYPE (n->decl))))
+ return false;
+ return true;
+}
+
/* Simple ipa profile pass propagating frequencies across the callgraph. */
static unsigned int
@@ -599,14 +620,7 @@ ipa_profile (void)
"Not speculating: target is overwritable "
"and can be discarded.\n");
}
- else if (ipa_node_params_sum && ipa_edge_args_sum
- && (!vec_safe_is_empty
- (IPA_NODE_REF (n2)->descriptors))
- && ipa_get_param_count (IPA_NODE_REF (n2))
- != ipa_get_cs_argument_count (IPA_EDGE_REF (e))
- && (ipa_get_param_count (IPA_NODE_REF (n2))
- >= ipa_get_cs_argument_count (IPA_EDGE_REF (e))
- || !stdarg_p (TREE_TYPE (n2->decl))))
+ else if (check_argument_count (n2, e))
{
nmismatch++;
if (dump_file)