https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118222
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|WAITING |RESOLVED --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > GCC has an IPA RA. > So if is_ENOTSUP is local to that file, GCC will see if edx is not clobbered > by that function, GCC can assume it can be used across the call. > > I am suspecting you are seeing that effect. Yes that is exactly it. is_ENOTSUP is defined in sys/system.h as: ``` static inline bool is_ENOTSUP (int err) { return err == EOPNOTSUPP || (ENOTSUP != EOPNOTSUPP && err == ENOTSUP); } ``` So when not inlined, GCC's IPA RA comes into play and knows that is_ENOTSUP does not clobber edx at all so it knows that specific call is not going to clobber edx so it can use it as such. This is 100% valid optimization since the function binds local to the TU and the call does NOT need to use the full x86_64 ABI here since GCC knows it can't be changed out. Aka this is by design, GCC 5 added this IPA optimization.