[Bug c/92716] -Os doesn't inline byteswap function even though it's a single instruction

jwerner at chromium dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 28 20:42:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92716

--- Comment #1 from Julius Werner <jwerner at chromium dot org> ---
edit: Just noticed that when I implement it as

static inline unsigned int byteswap(unsigned int x)                             
{                                                                               
        return __builtin_bswap32(x);                                            
}

instead, it is still compiled into the same single instruction, but then the
inlining works even with -Os. So I guess the decision to inline is made too
early in the optimization pipeline or something?


More information about the Gcc-bugs mailing list