Compiling optimized release build with debug info turns off optimizations?

Mikko Ronkainen mikoro at
Sat Dec 21 04:17:55 PST 2013

I want to profile a program with a profiler (say Intel VTune). If 
I have understood correctly, the build to be profiled should be 
an optimized release version. It would be beneficial to have 
debug info in that profile build though so that the profiler can 
show correct functions names etc.

Now if I add -g to an optimized build (-O3 -release) in LDC, it 
seems that all/some optimizations are turned off. The debug (-g) 
and profile (-O3 -release -g) builds have the same performance. 
Release (-O3 -release) is noticeably faster.

The profile build works as expected in GDC.

I don't know if this something to do with this:

More information about the digitalmars-d-ldc mailing list