Blame SOURCES/gcc8-rh1668903-2.patch

745403
commit 9939b2f79bd9b75b99080a17f3d6f1214d543477
745403
Author: qinzhao <qinzhao@138bc75d-0d04-0410-961f-82ee72b054a4>
745403
Date:   Wed Apr 3 19:00:25 2019 +0000
745403
745403
    2019-04-03  qing zhao  <qing.zhao@oracle.com>
745403
    
745403
            PR tree-optimization/89730
745403
            * ipa-inline.c (can_inline_edge_p): Delete the checking for
745403
            -flive-patching=inline-only-static.
745403
            (can_inline_edge_by_limits_p): Add the checking for
745403
            -flive-patching=inline-only-static and grant always_inline
745403
            even when -flive-patching=inline-only-static is specified.
745403
    
745403
            * gcc.dg/live-patching-4.c: New test.
745403
    
745403
    
745403
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270134 138bc75d-0d04-0410-961f-82ee72b054a4
745403
745403
--- gcc/ipa-inline.c
745403
+++ gcc/ipa-inline.c
745403
@@ -385,12 +385,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
745403
       e->inline_failed = CIF_ATTRIBUTE_MISMATCH;
745403
       inlinable = false;
745403
     }
745403
-  else if (callee->externally_visible
745403
-	   && flag_live_patching == LIVE_PATCHING_INLINE_ONLY_STATIC)
745403
-    {
745403
-      e->inline_failed = CIF_EXTERN_LIVE_ONLY_STATIC;
745403
-      inlinable = false;
745403
-    }
745403
   if (!inlinable && report)
745403
     report_inline_failed_reason (e);
745403
   return inlinable;
745403
@@ -433,6 +427,13 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
745403
      		 DECL_ATTRIBUTES (caller->decl))
745403
       && !caller_growth_limits (e))
745403
     inlinable = false;
745403
+  else if (callee->externally_visible
745403
+	   && !DECL_DISREGARD_INLINE_LIMITS (callee->decl)
745403
+	   && flag_live_patching == LIVE_PATCHING_INLINE_ONLY_STATIC)
745403
+    {
745403
+      e->inline_failed = CIF_EXTERN_LIVE_ONLY_STATIC;
745403
+      inlinable = false;
745403
+    }
745403
   /* Don't inline a function with a higher optimization level than the
745403
      caller.  FIXME: this is really just tip of iceberg of handling
745403
      optimization attribute.  */
745403
--- /dev/null
745403
+++ gcc/testsuite/gcc.dg/live-patching-4.c
745403
@@ -0,0 +1,23 @@
745403
+/* { dg-do compile } */
745403
+/* { dg-options "-O2 -flive-patching=inline-only-static -fdump-tree-einline-optimized" } */
745403
+
745403
+extern int sum, n, m;
745403
+
745403
+extern inline __attribute__((always_inline)) int foo (int a);
745403
+inline __attribute__((always_inline)) int foo (int a)
745403
+{
745403
+  return a + n;
745403
+}
745403
+
745403
+static int bar (int b)
745403
+{
745403
+  return b * m;
745403
+}
745403
+
745403
+int main()
745403
+{
745403
+  sum = foo (m) + bar (n); 
745403
+  return 0;
745403
+}
745403
+
745403
+/* { dg-final { scan-tree-dump "Inlining foo into main"  "einline" } } */