From 118aa5e31ce479bb81a003199b4c6ca0d997c9a2 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 19 Jan 2020 13:49:38 +0100 Subject: Fix ICE in speculative_call_info this fixes two issues with the new multi-target speculation code which reproduce on Firefox. I can now build firefox with FDO locally but on Mozilla build bots it still fails with ICE in speculative_call_info. One problem is that speuclative code compares call_stmt and lto_stmt_uid in a way that may get unwanted effect when these gets out of sync. It does not make sense to have both non-zero so I added code clearing it and sanity check that it is kept this way. Other problem is cgraph_edge::make_direct not working well with multiple targets. In this case it removed one speuclative target and the indirect call leaving other targets in the tree. This is fixed by iterating across all targets and removing all except the good one (if it exists). PR lto/93318 * cgraph.c (cgraph_edge::resolve_speculation): Fix foramting. (cgraph_edge::make_direct): Remove all indirect targets. (cgraph_edge::redirect_call_stmt_to_callee): Use make_direct.. (cgraph_node::verify_node): Verify that only one call_stmt or lto_stmt_uid is set. * cgraphclones.c (cgraph_edge::clone): Set only one call_stmt or lto_stmt_uid. * lto-cgraph.c (lto_output_edge): Simplify streaming of stmt. (lto_output_ref): Simplify streaming of stmt. * lto-streamer-in.c (fixup_call_stmt_edges_1): Clear lto_stmt_uid. --- gcc/cgraphclones.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/cgraphclones.c') diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index e73e069..417488b 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -132,7 +132,8 @@ cgraph_edge::clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid, new_edge->inline_failed = inline_failed; new_edge->indirect_inlining_edge = indirect_inlining_edge; - new_edge->lto_stmt_uid = stmt_uid; + if (!call_stmt) + new_edge->lto_stmt_uid = stmt_uid; new_edge->speculative_id = speculative_id; /* Clone flags that depend on call_stmt availability manually. */ new_edge->can_throw_external = can_throw_external; -- cgit v1.1