c - Why didn't -O3 GCC Optimization inline this function? -


In GCC compiler, when -off3 is flagged, the compiler primarily optimizes loop anaroling and function through inlining is.

However, when I compiled an application in which the following thing has been done, the function did not inlineing the function. From Gprofing and gconving I could notice that this function (comp_t_delay) was not called by the main function unit of this application. However, it is called by the function, which is called by the function, called by the main function.

Here is the code of comp_t_delay (int int, int ip) that I want to know that GCC optimizes it using '(OS, SIB, DX, DAI) - O3 (any help) Is appreciated!):

  Fixed float comp_t_delay (in int, int ip) {int sb, sib, dx, dy; T_type_ptr st, sit; Float D_SCI; D_ssi = 0.; Sb = net [in] .node_block [0]; St = Block [sb] .type; Sib = net [in] .node_block [ip]; Sit = Block [sib]. type; Assert (cents! = Null); Emphasis (sit! = Null); Dx = abs (block [sib] .x - block [sb] .x); Dy = abs (block [sib] .y - block [sb]. Y); If (cents == T_IO) {if (sit == T_IO) d_ssi = de_io [dx] [DA]; Else d_ssi = de_iof [dx] [DA]; } Else {if (sit == T_IO) d_ssi = de_fio [dx] [dy]; Other d_ssi = de_fb [dx] [DI]; } If (d_ssi <0) {printf ("Error 1 \ n"); Exit (1); } If (d_ssi <0.) {printf ("Error 2 \ n"); Exit (1); } Return (D_SCI); }  "

It was probably not the most inline because it is too long long functions, when Inline, it can be the reason for the code to run really slow - for example you get the CPU register bloated in more variable In this particular case the GCC decided that the function would be faster to not inline.


Comments