2.3 Optimization differences

Arm® Compiler 6 provides more performance optimization settings than are present in Arm Compiler 5. However, the optimizations that are performed at each optimization level might differ between the two toolchains.

The table compares the optimization settings and functions in Arm Compiler 5 and Arm Compiler 6.

Table 2-2 Optimization settings

Description Arm Compiler 5 Arm Compiler 6
Optimization levels for performance.
  • -Otime -O0
  • -Otime -O1
  • -Otime -O2
  • -Otime -O3
  • -O0
  • -O1
  • -O2
  • -O3
  • -Ofast
  • -Omax
Optimization levels for code size.
  • -Ospace -O0
  • -Ospace -O1
  • -Ospace -O2
  • -Ospace -O3
  • -Os
  • -Oz
Default -Ospace -O2 -O0
Best trade-off between image size, performance, and debug. -Ospace -O2 -O1
Highest optimization for performance -Otime -O3 -Omax
Highest optimization for code size -Ospace -O3 -Oz

Arm Compiler 6 provides an aggressive optimization setting, -Omax, which automatically enables a feature called Link Time Optimization. For more information, see -flto.

When using -Omax, armclang can perform link time optimizations that were not possible in Arm Compiler 5. These link time optimizations can expose latent bugs in the final image. Therefore, an image built with Arm Compiler 5 might have a different behavior to the image built with Arm Compiler 6.

For example, unused variables without the volatile keyword might be removed when using -Omax in Arm Compiler 6. If the unused variable is actually a volatile variable that requires the volatile keyword, then the removal of the variable can cause the generated image to behave unexpectedly. Since Arm Compiler 5 does not have this aggressive optimization setting, it might not have removed the unused variable, and the resulting image might behave as expected, and therefore the error in the code would be more difficult to detect.

Non-ConfidentialPDF file icon PDF version100068_0609_00_en
Copyright © 2014–2017 Arm Limited (or its affiliates). All rights reserved.