SPRUI04F july 2015 – april 2023
advice #30006: Loop at line 22 cannot be scheduled efficiently, as it
contains a function call ("function_name"). Try making "function_name" an
inline function.
For improved performance, at optimization levels --opt_level=2 (-O2) and --opt_level=3 (-O3), the compiler attempts to software pipeline your loops. Sometimes the compiler may not be able to inline a function call that is in a loop. Because the compiler could not inline the function call, the loop could not be software pipelined, and the loop could not be efficiently scheduled.
For example, in the test case below, call to function "func2" prevents software pipelining:
void func1(int *p, int *q, int n)
{
unsigned int i;
for (i = 0; i < n; i++) {
int t = func2(i);
; other operations
}
}
int function func2() { . . . }
However if function func2 is inlined, it saves the overhead of a function call. The compiler is free to optimize the function in context with surrounding code. Automatic inlining is controlled by the "inline" keyword; use it to allow inlining of specific functions :
inline int function func2() { . . . }
Also see #Advice 30000 in Section 4.15.6.