74 lines
2.3 KiB
Diff
74 lines
2.3 KiB
Diff
commit 9939b2f79bd9b75b99080a17f3d6f1214d543477
|
|
Author: qinzhao <qinzhao@138bc75d-0d04-0410-961f-82ee72b054a4>
|
|
Date: Wed Apr 3 19:00:25 2019 +0000
|
|
|
|
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.
|
|
|
|
|
|
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270134 138bc75d-0d04-0410-961f-82ee72b054a4
|
|
|
|
--- gcc/ipa-inline.c
|
|
+++ gcc/ipa-inline.c
|
|
@@ -385,12 +385,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
|
|
e->inline_failed = CIF_ATTRIBUTE_MISMATCH;
|
|
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)
|
|
report_inline_failed_reason (e);
|
|
return inlinable;
|
|
@@ -433,6 +427,13 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
|
|
DECL_ATTRIBUTES (caller->decl))
|
|
&& !caller_growth_limits (e))
|
|
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
|
|
caller. FIXME: this is really just tip of iceberg of handling
|
|
optimization attribute. */
|
|
--- /dev/null
|
|
+++ gcc/testsuite/gcc.dg/live-patching-4.c
|
|
@@ -0,0 +1,23 @@
|
|
+/* { 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 into main" "einline" } } */
|