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 #30000: Loop at line 10 cannot be scheduled efficiently, as it
contains a function call ("function_name"). Try to inline call
or consider rewriting loop.

Why is the Compiler giving this Advice ?

This Advice is issued to alert you to code, specifically a function call within a loop, that prevents software-pipelining. Software pipelining is a key optimization for achieving good performance. You may see reduced performance without software pipelining.


What it means:

The compiler attempts to perform the software pipeline loop optimization at optimization levels --opt_level=2 (or -O2) and -O3. If there is a call in the loop, the compiler will attempt to completely inline the called function, but sometimes this is not possible. If the compiler cannot inline the called function, software pipelining cannot be performed. This can severely reduce the performance of the loop.

Typical testcase: In the code below, the call to the function "func2" prevents software pipelining. Inlining function "func2" or rewriting the loop to avoid a function call can avoid pipeline disqualification; if the loop pipelines successfully you may see performance improvement.

 void func1(int *p, int *q, int n)
{
unsigned int i;

for (i = 0; i < n; i++)
{
int t = func2(i);

p[i] = q[i] + t;
}
}

Risks, Severity

Function calls in loops (such as call to "func2") prevent software pipelining, which can signficantly hurt performance.

Suggested Advice

If possible, move calls outside the loop. Otherwise, hand-inline calls; for instance replace the call to "func2" with the code in the body of "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.