Compiler Advice (on TI Wiki)

Advice 27000: Use Optimization Options
Advice 27001: Increase Optimization Level
Advice 27002: Do not turn off software pipelining
Advice 27003: Avoid compiling with debug options
Advice 27004: No Performance Advice generated
Advice 30000: Prevent Loop Disqualification due to call
Advice 30001: Prevent Loop Disqualification due to rts-call
Advice 30002: Prevent Loop Disqualification due to asm statement
Advice 30003: Prevent Loop Disqualification due to complex condition
Advice 30004: Prevent Loop Disqualification due to switch statement
Advice 30005: Prevent Loop Disqualification due to arithmetic operation
Advice 30006: Prevent Loop Disqualification due to call(2)
Advice 30007: Prevent Loop Disqualification due to rts-call(2)
Advice 30008: Improve Loop; Qualify with restrict
Advice 30009: Improve Loop; Add MUST_ITERATE pragma
Advice 30010: Improve Loop; Add MUST_ITERATE pragma(2)
Advice 30011: Improve Loop; Add _nassert()

Typical Advice

 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.

Why is the Compiler giving this Advice ?

There is a function call within a loop, which prevents the software-pipelining loop optimization. Software-pipelining is a key optimization for achieving good performance. You may see reduced performance without software pipelining.


What it means:

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 efficiently scheduled.

Typical testcase: In the code 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 the function func2 is inlined, it:

Automatic inlining is controlled by the "inline" keyword; use it to allow inlining of specific functions :

 inline int function func2() { . . . }


Risks, Severity

The function call "func2" in the loop, prevents software pipelining and better performance. While inlining improves performance, expanding functions inline may increase code size, especially inlining a function that is called in a number of places. Function inlining is optimal for functions that are called only from a small number of places and for small functions.


Suggested Action

Inline function call to "func2".

More Resources

Want to squeeze a few more Performance Cycles out of your application? Leverage the e2e (Engineer-to-Engineer) online community to get all of your Advice questions answered! Or, give back to the community with your expertise.

Go to the TI Compiler's e2e online forum! 

E2e.jpg For technical support please post your questions at http://e2e.ti.com.