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 #30003: Loop at line 8 cannot be scheduled efficiently, as it
contains complex conditional expression. Try to simplify
condition.

Why is the Compiler giving this Advice?

This Advice is issued to alert you to a complex conditional expression, generally a large "if" clause, within a loop. This will disable software-pipelining, which is critical for generating efficient code sequences.


What it means:

The C6000 compiler will optimize small if statements (if statements with if and else blocks that are short or empty). The compiler will not optimize large "if" statements, and such large if statements within the loop body will disqualify the loop for software pipelining. Software-pipelining is a key optimization; you will see reduced performance without software pipelining. In the simple examples below, Example 1 will pipeline, but Example 2 won't :

Example 1:

for (i=0; i < N; i++)
{
        if (!flag)
        {
           //statements
        }
        else
        {
          x[i] = y[i];
        }
}

Example 2:

for (i = 0; i < n; i++)
{
        if (!flag)
        {
           //statements
        }
        else
        {
           if (flag == 1) x[i] = y[i];
        }
}
Example 1 will have significantly better performance than Example 2 becaues it successfully pipelines. But Example 2 can be pipelined if the code is modified to eliminate the nested "if" :
for (i = 0; i < n; i++)
{
        if (!flag)
        {
           //statements
        }
        else
        {
           p = (flag == 1);
           x[i] = !p * x[i] + p * y[i] ;
        }
}

To see other examples of how "if" statements can be modified to allow software pipelining, refer to Hand Tuning Loops and Control Code on the TMS320C6000.


Risks, Severity

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


Suggested Action

Simplify complex conditional expression/"if" statements.

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.