[cfe-dev] selective/fine grained optimizations control

Domagoj Saric domagoj.saric at littleendian.com
Wed Aug 28 00:50:35 PDT 2013


We have a project which Clang miscompiles in release builds (in short "the GUI 
shows up empty"). "It all worked fine" up until and including Xcode 4.2, with 
all later versions (of Xcode and consequently of Clang shipped with it) this bug 
manifests itself. As we officially switched to Xcode 4.6.3 I have to find a way 
to workaround or fix this problem.

The bug manifests already with -O1 while it does not with -O0 so I need a way to 
selectively enable or disable optimizations turned on at O1. GCC nicely 
documents which optimizations are turned on by individual -O levels and offers 
the various -fno-* options for fine grained control but unfortunately Clang does 
not actually support GCC's command line options other than the basic ones.

I did find this
http://stackoverflow.com/questions/15548023/clang-optimization-levels
but it didn't help: I tried -O0 -mllvm -sroa and got:
clang (LLVM option parsing): Unknown command line argument '-sroa'.  Try: 'clang 
(LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-help'?


Is there any other way to achieve fine grained optimizations control?


-- 
Domagoj Saric
Software Architect
www.LittleEndian.com



More information about the cfe-dev mailing list