From 7123347c8b44571811c4b58506b06fb09969bccb Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Thu, 16 Apr 2020 19:21:02 +0200 Subject: ipa: Make call redirection detect already adjusted calls (PR 93621) PR 93621 testcase makes redirect_call_stmt_to_callee wrongly assume that a call statement needs redirecting but then rightly fails an assert ensuring the call statement parameters have not already been adjusted because they were already created adjusted as part of thunk expansion. The test fails because the decl in the call call statement is different than the decl of the callee, because the latter was created in save_inline_function_body. This patch adds a way to link these two and detect the situation in redirect_call_stmt_to_callee. 2020-04-16 Martin Jambor PR ipa/93621 * ipa-inline.h (ipa_saved_clone_sources): Declare. * ipa-inline-transform.c (ipa_saved_clone_sources): New variable. (save_inline_function_body): Link the new body holder with the previous one. * cgraph.c: Include ipa-inline.h. (cgraph_edge::redirect_call_stmt_to_callee): Try to find the decl from the statement in ipa_saved_clone_sources. * cgraphunit.c: Include ipa-inline.h. (expand_all_functions): Free ipa_saved_clone_sources. testsuite/ * g++.dg/ipa/pr93621.C: New test. --- gcc/ipa-inline.h | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/ipa-inline.h') diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h index 5025b60..74c0868 100644 --- a/gcc/ipa-inline.h +++ b/gcc/ipa-inline.h @@ -65,6 +65,7 @@ void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *); extern int ncalls_inlined; extern int nfunctions_inlined; +extern function_summary *ipa_saved_clone_sources; /* Return estimated size of the inline sequence of EDGE. */ -- cgit v1.1