aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2016-05-16 12:10:28 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2016-05-16 10:10:28 +0000
commit0b9004ed5642ab56f97347cc9c5ca9a59a2fb6bb (patch)
tree2fad4cf8e62a6fa8390658fc1bb6621e961d826e /gcc
parentc1d854fb24ba20ecdd1736117a5e5cd39686e479 (diff)
downloadgcc-0b9004ed5642ab56f97347cc9c5ca9a59a2fb6bb.zip
gcc-0b9004ed5642ab56f97347cc9c5ca9a59a2fb6bb.tar.gz
gcc-0b9004ed5642ab56f97347cc9c5ca9a59a2fb6bb.tar.bz2
ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic on estimating thunk bodies...
* ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic on estimating thunk bodies; do not set inline_failed to CIF_THUNK for calls from thunk. * ipa-inline-transform.c (inline_call): When inlining into thunk produce gimple body. (preserve_function_body_p): No need to preserve function body * cif-codes.def (CIF_THUNK): Remove. * cgraphclones.c (duplicate_thunk_for_node): Thunks calls are inlinable. * g++.dg/ipa/ivinline-7.C: Do not xfail. * g++.dg/ipa/ivinline-9.C: Do not xfail. From-SVN: r236274
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cgraph.c2
-rw-r--r--gcc/cgraphclones.c2
-rw-r--r--gcc/cif-code.def4
-rw-r--r--gcc/ipa-inline-analysis.c10
-rw-r--r--gcc/ipa-inline-transform.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/ivinline-7.C2
-rw-r--r--gcc/testsuite/g++.dg/ipa/ivinline-9.C2
9 files changed, 37 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 23f03a7..7f70b9c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
2016-05-16 Jan Hubicka <hubicka@ucw.cz>
+ * ipa-inline-analysis.c (compute_inline_parameters): Be more reailistic
+ on estimating thunk bodies; do not set inline_failed to CIF_THUNK for
+ calls from thunk.
+ * ipa-inline-transform.c (inline_call): When inlining into thunk produce
+ gimple body.
+ (preserve_function_body_p): No need to preserve function body
+ * cif-codes.def (CIF_THUNK): Remove.
+ * cgraphclones.c (duplicate_thunk_for_node): Thunks calls are inlinable.
+
+2016-05-16 Jan Hubicka <hubicka@ucw.cz>
+
* tree-inline.c (expand_call_inline): recurse after inlining thunk.
2016-05-16 Jan Hubicka <hubicka@ucw.cz>
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 0c6ff93..6fcdbdd 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3324,7 +3324,7 @@ cgraph_node::verify_node (void)
error ("More than one edge out of thunk node");
error_found = true;
}
- if (gimple_has_body_p (decl))
+ if (gimple_has_body_p (decl) && !global.inlined_to)
{
error ("Thunk is not supposed to have body");
error_found = true;
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 43ee735..97eb927 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -337,8 +337,6 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
cgraph_edge *e = new_thunk->create_edge (node, NULL, 0,
CGRAPH_FREQ_BASE);
- e->call_stmt_cannot_inline_p = true;
- e->inline_failed = CIF_THUNK;
symtab->call_edge_duplication_hooks (thunk->callees, e);
symtab->call_cgraph_duplication_hooks (thunk, new_thunk);
return new_thunk;
diff --git a/gcc/cif-code.def b/gcc/cif-code.def
index f112e96..196151f 100644
--- a/gcc/cif-code.def
+++ b/gcc/cif-code.def
@@ -95,10 +95,6 @@ DEFCIFCODE(MISMATCHED_ARGUMENTS, CIF_FINAL_ERROR,
DEFCIFCODE(LTO_MISMATCHED_DECLARATIONS, CIF_FINAL_ERROR,
N_("mismatched declarations during linktime optimization"))
-/* Caller is thunk. */
-DEFCIFCODE(THUNK, CIF_FINAL_ERROR,
- N_("thunk call"))
-
/* Call was originally indirect. */
DEFCIFCODE(ORIGINALLY_INDIRECT_CALL, CIF_FINAL_NORMAL,
N_("originally indirect function call not considered for inlining"))
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 17b21d1..82d1774 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2932,11 +2932,13 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
struct inline_edge_summary *es = inline_edge_summary (node->callees);
struct predicate t = true_predicate ();
- node->callees->inline_failed = CIF_THUNK;
node->local.can_change_signature = false;
- es->call_stmt_size = INLINE_SIZE_SCALE;
- es->call_stmt_time = INLINE_TIME_SCALE;
- account_size_time (info, INLINE_SIZE_SCALE * 2, INLINE_TIME_SCALE * 2, &t);
+ es->call_stmt_size = eni_size_weights.call_cost;
+ es->call_stmt_time = eni_time_weights.call_cost;
+ account_size_time (info, INLINE_SIZE_SCALE * 2,
+ INLINE_TIME_SCALE * 2, &t);
+ t = not_inlined_predicate ();
+ account_size_time (info, 2 * INLINE_SIZE_SCALE, 0, &t);
inline_update_overall_summary (node);
info->self_size = info->size;
info->self_time = info->time;
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 759617b..1e6e108 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -314,12 +314,20 @@ inline_call (struct cgraph_edge *e, bool update_original,
/* Don't even think of inlining inline clone. */
gcc_assert (!callee->global.inlined_to);
- e->inline_failed = CIF_OK;
- DECL_POSSIBLY_INLINED (callee->decl) = true;
-
to = e->caller;
if (to->global.inlined_to)
to = to->global.inlined_to;
+ if (to->thunk.thunk_p)
+ {
+ if (in_lto_p)
+ to->get_untransformed_body ();
+ to->expand_thunk (false, true);
+ e = to->callees;
+ }
+
+
+ e->inline_failed = CIF_OK;
+ DECL_POSSIBLY_INLINED (callee->decl) = true;
if (DECL_FUNCTION_PERSONALITY (callee->decl))
DECL_FUNCTION_PERSONALITY (to->decl)
@@ -580,7 +588,7 @@ preserve_function_body_p (struct cgraph_node *node)
gcc_assert (!node->alias && !node->thunk.thunk_p);
/* Look if there is any clone around. */
- if (node->clones)
+ if (node->clones && !node->clones->thunk.thunk_p)
return true;
return false;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1598857..c5f151f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-16 Jan Hubicka <hubicka@ucw.cz>
+
+ * g++.dg/ipa/ivinline-7.C: Do not xfail.
+ * g++.dg/ipa/ivinline-9.C: Do not xfail.
+
2016-05-16 Matthew Wahab <matthew.wahab@arm.com>
* g++.dg/ext/arm-fp16/fp16-param-1.c: Update expected output. Add
diff --git a/gcc/testsuite/g++.dg/ipa/ivinline-7.C b/gcc/testsuite/g++.dg/ipa/ivinline-7.C
index b725db5..a7b41e7 100644
--- a/gcc/testsuite/g++.dg/ipa/ivinline-7.C
+++ b/gcc/testsuite/g++.dg/ipa/ivinline-7.C
@@ -76,4 +76,4 @@ int main (int argc, char *argv[])
}
/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::.*foo" "inline" } } */
-/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main" "inline" { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main" "inline" } } */
diff --git a/gcc/testsuite/g++.dg/ipa/ivinline-9.C b/gcc/testsuite/g++.dg/ipa/ivinline-9.C
index f6110c1..41b2381 100644
--- a/gcc/testsuite/g++.dg/ipa/ivinline-9.C
+++ b/gcc/testsuite/g++.dg/ipa/ivinline-9.C
@@ -90,4 +90,4 @@ int main (int argc, char *argv[])
}
/* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::.*foo" "inline" } } */
-/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main" "inline" { xfail *-*-* } } } */
+/* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main" "inline" } } */