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 #30005: Loop at line 5 cannot be scheduled efficiently, as it
contains a "division" operation. Rewrite using simpler
operations if possible.

Why is the Compiler giving this Advice ?

The compiler is inserting a special function call within a loop, which prevents the software pipelining optimization. Software pipelining is a key compiler optimization for achieving good performance. You are getting this Advice so you can take steps to potentially prevent this pipeline disqualification.


What it means:

The compiler can insert calls to special functions in the run-time support library (RTS) to support operations that are not natively supported by the ISA. For example, the compiler calls __c6xabi_divi() (_divi() in COFF) function to perform 32-bit integer divide operation. Such functions are called compiler helper functions, and result in a function call withing the loop body. In the example below, the compiler will accomplish the division operation by calling the compiler helper function "_divi" :

void func(float *p, float n)
{
     int i;
 
     for (i = 1; i < 1000; i++)
     {
         p[i] /= n;
     }
}

However if we modify this loop, like below, the loop pipelines :

void func_adjusted(float *p, float n)
{
     int i;
 
     float inv = 1/n;
 
     for (i = 1; i < 1000; i++)
     {
         p[i] *= inv;
     }
}

Any call in a loop, including calls to compiler helper functions, disables software pipelining, and this may result in a drop in performance.


Risks, Severity

If this condition occurs, the compiler cannot perform the software pipelining loop optimization, which is crucial to getting good performance.


Suggested Action

Rewrite code using simpler operation(s).

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.