This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto][patch] Use "extern inline" instead of "static inline"


Some extra context:

Without this patch we transform cherry picked functions into static
inline. If we cherry pick the same function into two or more files, we
will have multiple static functions corresponding to the original
static one. This is usually fine, since those functions are normally
used for inlining and then dropped. This is not the case if one the
file uses the function as a value since then the  static function will
not dropped.

What the attached testcase does is have two function in different
files return pointers to what should be the same function "bar".
Without the patch the inliner will produce two static functions and
the pointers will be different.

Using extern inline solves the problem, since the compiler will drop
the function and use external references after inlining.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]