Clang 11 Changes -O To Match GCC Behavior

Written by Michael Larabel in LLVM on 19 May 2020 at 07:08 AM EDT. 13 Comments
LLVM
Clang 11.0 has changed its "-O" optimization flag to match the defaults of GCC.

LLVM Clang currently treats the -O option as matching the -O2 optimization level as that was chosen back when Clang didn't differ between -O1 and -O2 optimization levels. GCC meanwhile has treated -O as the -O1 optimization level.

But now with Clang's -O1 and -O2 behavior differing, Clang has changed its -O behavior to -O1 in matching the characteristics of the GNU Compiler Collection.

The change is in Clang Git for the 11.0 milestone this autumn. No changes were made to any of the optimization levels with this commit but simply the behavior of "-O" should you be using that for any of your compiler flag optimization levels it will now be slightly less aggressive.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week