This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6000 Codegen v7.4.13: Long compile times for large switch statement

We're seeing surprisingly long compile times (~6 minutes) for a source file that includes a large switch statement.  The switch statement is used to test a large structure of device register definitions and init values.   This approach is used to make low level code more readable, however the compile time is extremely long.  Are there any known problems that could cause this, or are there any compiler options or other tricks that could be used to speed this up?

  • I have not heard of this issue before.  I'd appreciate if we could get a test case and reproduce it.  Please preprocess the problem source file and attach to your next post.  Please show all the build options exactly as the compiler sees them.

    Thanks and regards,

    -George

  • Thank you for sending a test case by other channels.  I can reproduce the problem.  I filed CODEGEN-1633 in the SDOWP system to have this addressed.  You are welcome to follow it with the SDOWP link below in my signature.

    rperezti said:
    are there any compiler options or other tricks that could be used to speed this up?

    Unfortunately, I could not find any.  Perhaps, after the bug is analyzed, some workaround may be discovered.

    Thanks and regards,

    -George

  • From a brief analysis, I believe there is nothing unexpected going on with this test case. Unfortunately, this is just an example of where the heuristics used in the TI compiler take longer than one would expect on very large (machine generated?) input. This is a known issue, and we'd rather fix it, but work for this is not presently on the roadmap. You could set the build options to "-g" for just this file, which cuts the compilation time down to 2.5 minutes or so, but I'm betting you'd be better off just accepting the compilation time at -o3.
  • Did you mean to suggest that the '-g' option be excluded from the compilation of this file?

    Using the v7.4.13 and then the latest available release in the C6x CGT v7.4.x release chain, v7.4.19. I saw compile-times in the 5 to 6 minute range, consistent with what was reported earlier.

    If I remove the '-g' option from the command line, I saw some compile-time reduction, but more in the range of ~1 minute faster.

    ~ Todd Snider

  • No, I meant remove the -O option and use only -g
  • Further analysis confirms the initial analysis - the TI compiler is generally inordinately slow on larger functions. Yes, this is a known issue, and we'd certainly like to fix it, but this work is not presently on the roadmap. The recommended workaround is to split the function into smaller units.
  • Thank you.  Is there any further guidance on the size to target for these switch statements to minimize impact on compile time?

  • Not really, other than that if you feel it takes to long, to try to reduce the size of the function by splitting it up. Note that I don't think the fact that a switch statement is involved impacts the compilation time.