Commit 7ce7e4d4 by Jan Hubicka Committed by Jan Hubicka

ipa-inline.c (can_inline_edge_p): Short circuit if inline_failed already is final.


	* ipa-inline.c (can_inline_edge_p): Short circuit if inline_failed
	already is final.
	(ipa_inline): Recompute inline_failed codes.
	* cif-code.def (FUNCTION_NOT_OPTIMIZED, REDEFINED_EXTERN_INLINE,
	USES_COMDAT_LOCAL, ATTRIBUTE_MISMATCH, UNREACHABLE): Declare as 
	CIF_FINAL_ERROR.

From-SVN: r221530
parent 21e357f1
2015-03-20 Jan Hubicka <hubicka@ucw.cz>
* ipa-inline.c (can_inline_edge_p): Short circuit if inline_failed
already is final.
(ipa_inline): Recompute inline_failed codes.
* cif-code.def (FUNCTION_NOT_OPTIMIZED, REDEFINED_EXTERN_INLINE,
USES_COMDAT_LOCAL, ATTRIBUTE_MISMATCH, UNREACHABLE): Declare as
CIF_FINAL_ERROR.
2015-03-20 Uros Bizjak <ubizjak@gmail.com> 2015-03-20 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/60851 PR rtl-optimization/60851
......
...@@ -39,7 +39,7 @@ DEFCIFCODE(FUNCTION_NOT_CONSIDERED, CIF_FINAL_NORMAL, ...@@ -39,7 +39,7 @@ DEFCIFCODE(FUNCTION_NOT_CONSIDERED, CIF_FINAL_NORMAL,
N_("function not considered for inlining")) N_("function not considered for inlining"))
/* Caller is compiled with optimizations disabled. */ /* Caller is compiled with optimizations disabled. */
DEFCIFCODE(FUNCTION_NOT_OPTIMIZED, CIF_FINAL_NORMAL, DEFCIFCODE(FUNCTION_NOT_OPTIMIZED, CIF_FINAL_ERROR,
N_("caller is not optimized")) N_("caller is not optimized"))
/* Inlining failed owing to unavailable function body. */ /* Inlining failed owing to unavailable function body. */
...@@ -47,7 +47,7 @@ DEFCIFCODE(BODY_NOT_AVAILABLE, CIF_FINAL_ERROR, ...@@ -47,7 +47,7 @@ DEFCIFCODE(BODY_NOT_AVAILABLE, CIF_FINAL_ERROR,
N_("function body not available")) N_("function body not available"))
/* Extern inline function that has been redefined. */ /* Extern inline function that has been redefined. */
DEFCIFCODE(REDEFINED_EXTERN_INLINE, CIF_FINAL_NORMAL, DEFCIFCODE(REDEFINED_EXTERN_INLINE, CIF_FINAL_ERROR,
N_("redefined extern inline functions are not considered for " N_("redefined extern inline functions are not considered for "
"inlining")) "inlining"))
...@@ -87,10 +87,6 @@ DEFCIFCODE(UNLIKELY_CALL, CIF_FINAL_NORMAL, ...@@ -87,10 +87,6 @@ DEFCIFCODE(UNLIKELY_CALL, CIF_FINAL_NORMAL,
DEFCIFCODE(NOT_DECLARED_INLINED, CIF_FINAL_NORMAL, DEFCIFCODE(NOT_DECLARED_INLINED, CIF_FINAL_NORMAL,
N_("function not declared inline and code size would grow")) N_("function not declared inline and code size would grow"))
/* Inlining suppressed due to size optimization. */
DEFCIFCODE(OPTIMIZING_FOR_SIZE, CIF_FINAL_NORMAL,
N_("optimizing for size and code size would grow"))
/* Caller and callee disagree on the arguments. */ /* Caller and callee disagree on the arguments. */
DEFCIFCODE(MISMATCHED_ARGUMENTS, CIF_FINAL_ERROR, DEFCIFCODE(MISMATCHED_ARGUMENTS, CIF_FINAL_ERROR,
N_("mismatched arguments")) N_("mismatched arguments"))
...@@ -121,13 +117,13 @@ DEFCIFCODE(OPTIMIZATION_MISMATCH, CIF_FINAL_ERROR, ...@@ -121,13 +117,13 @@ DEFCIFCODE(OPTIMIZATION_MISMATCH, CIF_FINAL_ERROR,
N_("optimization level attribute mismatch")) N_("optimization level attribute mismatch"))
/* We can't inline because the callee refers to comdat-local symbols. */ /* We can't inline because the callee refers to comdat-local symbols. */
DEFCIFCODE(USES_COMDAT_LOCAL, CIF_FINAL_NORMAL, DEFCIFCODE(USES_COMDAT_LOCAL, CIF_FINAL_ERROR,
N_("callee refers to comdat-local symbols")) N_("callee refers to comdat-local symbols"))
/* We can't inline because of mismatched caller/callee attributes. */ /* We can't inline because of mismatched caller/callee attributes. */
DEFCIFCODE(ATTRIBUTE_MISMATCH, CIF_FINAL_NORMAL, DEFCIFCODE(ATTRIBUTE_MISMATCH, CIF_FINAL_ERROR,
N_("function attribute mismatch")) N_("function attribute mismatch"))
/* We proved that the call is unreachable. */ /* We proved that the call is unreachable. */
DEFCIFCODE(UNREACHABLE, CIF_FINAL_NORMAL, DEFCIFCODE(UNREACHABLE, CIF_FINAL_ERROR,
N_("unreachable")) N_("unreachable"))
...@@ -312,6 +312,15 @@ static bool ...@@ -312,6 +312,15 @@ static bool
can_inline_edge_p (struct cgraph_edge *e, bool report, can_inline_edge_p (struct cgraph_edge *e, bool report,
bool disregard_limits = false, bool early = false) bool disregard_limits = false, bool early = false)
{ {
gcc_checking_assert (e->inline_failed);
if (cgraph_inline_failed_type (e->inline_failed) == CIF_FINAL_ERROR)
{
if (report)
report_inline_failed_reason (e);
return false;
}
bool inlinable = true; bool inlinable = true;
enum availability avail; enum availability avail;
cgraph_node *callee = e->callee->ultimate_alias_target (&avail); cgraph_node *callee = e->callee->ultimate_alias_target (&avail);
...@@ -323,9 +332,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -323,9 +332,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
struct function *caller_fun = caller->get_fun (); struct function *caller_fun = caller->get_fun ();
struct function *callee_fun = callee ? callee->get_fun () : NULL; struct function *callee_fun = callee ? callee->get_fun () : NULL;
gcc_assert (e->inline_failed); if (!callee->definition)
if (!callee || !callee->definition)
{ {
e->inline_failed = CIF_BODY_NOT_AVAILABLE; e->inline_failed = CIF_BODY_NOT_AVAILABLE;
inlinable = false; inlinable = false;
...@@ -363,8 +370,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -363,8 +370,7 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
} }
/* TM pure functions should not be inlined into non-TM_pure /* TM pure functions should not be inlined into non-TM_pure
functions. */ functions. */
else if (is_tm_pure (callee->decl) else if (is_tm_pure (callee->decl) && !is_tm_pure (caller->decl))
&& !is_tm_pure (caller->decl))
{ {
e->inline_failed = CIF_UNSPECIFIED; e->inline_failed = CIF_UNSPECIFIED;
inlinable = false; inlinable = false;
...@@ -2289,7 +2295,22 @@ ipa_inline (void) ...@@ -2289,7 +2295,22 @@ ipa_inline (void)
nnodes = ipa_reverse_postorder (order); nnodes = ipa_reverse_postorder (order);
FOR_EACH_FUNCTION (node) FOR_EACH_FUNCTION (node)
node->aux = 0; {
node->aux = 0;
/* Recompute the default reasons for inlining because they may have
changed during merging. */
if (in_lto_p)
{
for (cgraph_edge *e = node->callees; e; e = e->next_callee)
{
gcc_assert (e->inline_failed);
initialize_inline_failed (e);
}
for (cgraph_edge *e = node->indirect_calls; e; e = e->next_callee)
initialize_inline_failed (e);
}
}
if (dump_file) if (dump_file)
fprintf (dump_file, "\nFlattening functions:\n"); fprintf (dump_file, "\nFlattening functions:\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment