Commit bc53dee0 by Qing Zhao Committed by Qing Zhao

re PR tree-optimization/89730 (-flive-patching=inline-only-static should grant…

re PR tree-optimization/89730 (-flive-patching=inline-only-static should grant always_inline attribute for extern function)

2019-04-03  qing zhao  <qing.zhao@oracle.com>

	PR tree-optimization/89730
	* ipa-inline.c (can_inline_edge_p): Delete the checking for
	-flive-patching=inline-only-static.
	(can_inline_edge_by_limits_p): Add the checking for 
	-flive-patching=inline-only-static and grant always_inline
	even when -flive-patching=inline-only-static is specified. 

	* gcc.dg/live-patching-4.c: New test.

From-SVN: r270134
parent c1d9a8f5
2019-04-03 qing zhao <qing.zhao@oracle.com>
PR tree-optimization/89730
* ipa-inline.c (can_inline_edge_p): Delete the checking for
-flive-patching=inline-only-static.
(can_inline_edge_by_limits_p): Add the checking for
-flive-patching=inline-only-static and grant always_inline
even when -flive-patching=inline-only-static is specified.
2019-04-03 Jeff Law <law@redhat.com> 2019-04-03 Jeff Law <law@redhat.com>
PR rtl-optimization/81025 PR rtl-optimization/81025
......
...@@ -385,12 +385,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report, ...@@ -385,12 +385,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
e->inline_failed = CIF_ATTRIBUTE_MISMATCH; e->inline_failed = CIF_ATTRIBUTE_MISMATCH;
inlinable = false; inlinable = false;
} }
else if (callee->externally_visible
&& flag_live_patching == LIVE_PATCHING_INLINE_ONLY_STATIC)
{
e->inline_failed = CIF_EXTERN_LIVE_ONLY_STATIC;
inlinable = false;
}
if (!inlinable && report) if (!inlinable && report)
report_inline_failed_reason (e); report_inline_failed_reason (e);
return inlinable; return inlinable;
...@@ -433,6 +427,13 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report, ...@@ -433,6 +427,13 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
DECL_ATTRIBUTES (caller->decl)) DECL_ATTRIBUTES (caller->decl))
&& !caller_growth_limits (e)) && !caller_growth_limits (e))
inlinable = false; inlinable = false;
else if (callee->externally_visible
&& !DECL_DISREGARD_INLINE_LIMITS (callee->decl)
&& flag_live_patching == LIVE_PATCHING_INLINE_ONLY_STATIC)
{
e->inline_failed = CIF_EXTERN_LIVE_ONLY_STATIC;
inlinable = false;
}
/* Don't inline a function with a higher optimization level than the /* Don't inline a function with a higher optimization level than the
caller. FIXME: this is really just tip of iceberg of handling caller. FIXME: this is really just tip of iceberg of handling
optimization attribute. */ optimization attribute. */
......
2019-04-03 qing zhao <qing.zhao@oracle.com>
PR tree-optimization/89730
* gcc.dg/live-patching-4.c: New test.
2019-04-03 Clément Chigot <clement.chigot@atos.net> 2019-04-03 Clément Chigot <clement.chigot@atos.net>
* lib/go-torture.exp: Only add lto to TORTURE_OPTIONS if it is * lib/go-torture.exp: Only add lto to TORTURE_OPTIONS if it is
......
/* { dg-do compile } */
/* { dg-options "-O2 -flive-patching=inline-only-static -fdump-tree-einline-optimized" } */
extern int sum, n, m;
extern inline __attribute__((always_inline)) int foo (int a);
inline __attribute__((always_inline)) int foo (int a)
{
return a + n;
}
static int bar (int b)
{
return b * m;
}
int main()
{
sum = foo (m) + bar (n);
return 0;
}
/* { dg-final { scan-tree-dump "Inlining foo/0 into main/2" "einline" } } */
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