[llvm-dev] RelWithDebInfo vs Release optimization level?

Andy Ayers via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 16 11:15:34 PDT 2016


Hmm, VS doesn't have an -O3.

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-bounces at 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 <dexonsmith at apple.com>
Cc: llvm-dev <llvm-dev at 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-dev at 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-dev at 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-dev at lists.llvm.org
>> https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists
>> .llvm.org%2fcgi-bin%2fmailman%2flistinfo%2fllvm-dev&data=01%7c01%7can
>> dya%40microsoft.com%7c1ff00318e3b149b8560808d34d4c1f58%7c72f988bf86f1
>> 41af91ab2d7cd011db47%7c1&sdata=TJbe1pdIZrJ1M5BAf3zR1xceVWaURXG7WE0SvO
>> ofodg%3d
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.
> llvm.org%2fcgi-bin%2fmailman%2flistinfo%2fllvm-dev&data=01%7c01%7candy
> a%40microsoft.com%7c1ff00318e3b149b8560808d34d4c1f58%7c72f988bf86f141a
> f91ab2d7cd011db47%7c1&sdata=TJbe1pdIZrJ1M5BAf3zR1xceVWaURXG7WE0SvOofod
> g%3d
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2flists.llvm.org%2fcgi-bin%2fmailman%2flistinfo%2fllvm-dev%0a&data=01%7c01%7candya%40microsoft.com%7c1ff00318e3b149b8560808d34d4c1f58%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=Dce6pEFKGU%2fyph%2f86lZPAc1PVvvhjPa5ZP%2bV6OMOb%2bk%3d


More information about the llvm-dev mailing list