for the following small testing case: 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; } with the latest upstream gcc9: /home/qinzhao/Install/latest/bin/gcc -O3 -flive-patching=inline-only-static -fdump-tree-einline -fdump-ipa-inline -fopt-info-inline-all=inline.txt t.c t.c: In function ‘main’: t.c:7:43: error: inlining failed in call to always_inline ‘foo’: function has external linkage when the user requests only inlining static for live patching 7 | inline __attribute__((always_inline)) int foo (int a) | ^~~ t.c:20:9: note: called from here 20 | sum = foo (m) + bar (n); | ^~~~~~~ t.c:7:43: error: inlining failed in call to always_inline ‘foo’: function has external linkage when the user requests only inlining static for live patching 7 | inline __attribute__((always_inline)) int foo (int a) | ^~~ t.c:20:9: note: called from here 20 | sum = foo (m) + bar (n); | ^~~~~~~ We should grant extern alway_inline routine to be inlined even with -flive-patching=inline-only-static.
always_inline should simply be always inlined.
Author: qinzhao Date: Wed Apr 3 19:00:25 2019 New Revision: 270134 URL: https://gcc.gnu.org/viewcvs?rev=270134&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/gcc.dg/live-patching-4.c Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-inline.c trunk/gcc/testsuite/ChangeLog