Fix ICE in speculative_call_info
authorJan Hubicka <jh@suse.cz>
Sun, 19 Jan 2020 12:49:38 +0000 (13:49 +0100)
committerJan Hubicka <jh@suse.cz>
Sun, 19 Jan 2020 12:49:38 +0000 (13:49 +0100)
commit118aa5e31ce479bb81a003199b4c6ca0d997c9a2
tree39628edc50f14d10ca77e933975701a81f550d14
parent52354dadb80b60c3fd05fb1b5aa3feb15a98b8af
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/ChangeLog
gcc/cgraph.c
gcc/cgraphclones.c
gcc/lto-cgraph.c
gcc/lto-streamer-in.c