https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89990
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew D'Addesio from comment #7) > > This actually has gotten me curious. Would you have an idea/explanation > behind that 2 function call threshold @Andrew Pinski? Most likely it is due to jump threading optimization not happening if there are 2 calls while it is happening with 1. That is the growth of copying 1 call is reasonable while 2 is not when removing the extra jump. That is transforming: ``` int test(int x) { const unsigned char buf[32]; const struct mytype *ptr = &d; if (x != 0) ptr = &(const struct mytype){ 43 }; foo(buf); #ifdef CALL_FOO_TWICE foo(buf); #endif return ptr->c; } ``` into something like: ``` int test(int x) { const unsigned char buf[32]; const struct mytype *ptr; if (x != 0) goto a; else goto b; a: { ptr = &(const struct mytype){ 43 }; } foo(buf); #ifdef CALL_FOO_TWICE foo(buf); #endif return ptr->c; b: foo(buf); #ifdef CALL_FOO_TWICE foo(buf); #endif return d.c; } ``` Where doing 2 copies of 2 calls is too expensive to be done.