In VS, -O1 and -O2 (with -Zi/-Z7 and link -debug) or their package equivalents -Os and -Ot will be equally well debuggable/non-debuggable. -Od is the only way to get a full debug experience.
In recent versions, the emission of optimized debug info (-Zo, on by default) makes for a reasonable experience debugging O1/O2/LTCG/PGO builds.
-----Original Message-----
From: llvm-dev [mailto:
llvm-dev...@lists.llvm.org] On Behalf Of Chris Bieneman via llvm-dev
Sent: Tuesday, March 15, 2016 8:36 PM
To: Duncan P. N. Exon Smith <
dexon...@apple.com>
Cc: llvm-dev <
llvm...@lists.llvm.org>
Subject: Re: [llvm-dev] RelWithDebInfo vs Release optimization level?
The default values for the optimization level are provided by CMake. My stab in the dark here is that the difference originates as a behavior matching Visual Studio. Historically VS lowered optimization to -O2 if you built with debug info because the -O3 builds were basically undebugable.
Changing this default in our CMake configurations might be tricky and error prone because there isn't a good way to know that the variable isn't set by the user. This is basically the perennial CMake cache invalidation problem.
-Chris
> On Mar 15, 2016, at 4:44 PM, Duncan P. N. Exon Smith via llvm-dev <
llvm...@lists.llvm.org> wrote:
>
> I also assumed they were the same, and I have been using them that
> way. I agree they should match.
>
>> On 2016-Mar-15, at 15:20, Mehdi Amini via llvm-dev <
llvm...@lists.llvm.org> wrote:
>>
>> Hi all,
>>
>> These two cmake configuration are using different optimization levels (O2 vs O3). What is the rational for that? I know that O1 is "supposingly" more friendly for debugging, but I don't think we make such claim for O2 vs O3, are we?
>>
>> I'd expect RelWithDebInfo to be what the name says, i.e. Release + debug-information.
>>
>>
>> --
>> Mehdi
>>
>> _______________________________________________
>> LLVM Developers mailing list
>>
llvm...@lists.llvm.org
>> .