ipa/122852: Don't delete unreachable callback edges.

Hi,
previously, callback edges of a carrying edge redirected to
__builtin_unreachable  were deleted, as I thought they would
mess with the callgraph, given that they were no longer correct.
In some cases, the edges would be deleted when duplicating
a fn summary, producing a segfault. This patch changes this
behavior.  It redirects the callback edges to __builtin_unreachable and
adds an exception for such cases in the verifier.  Callback edges are
now also required to point to __builtin_unreachable if their carrying
edge is pointing to __builtin_unreachable.

Bootstrapped and regtested on x86_64-linux, no regressions.

OK for master?

Thanks,
Josef

	PR ipa/122852

gcc/ChangeLog:

	* cgraph.cc (cgraph_node::verify_node): Verify that callback
	edges are unreachable when the carrying edge is unreachable.
	* ipa-fnsummary.cc (redirect_to_unreachable): Redirect callback
	edges to unreachable when redirecting the carrying edge.

libgomp/ChangeLog:

	* testsuite/libgomp.c/pr122852.c: New test.

Signed-off-by: Josef Melcr <josef.melcr@suse.com>
3 files changed