[PATCH] D55056: [CMake] Default options for faster executables on MSVC

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 12:29:22 PST 2018


aganea added a comment.

In D55056#1314996 <https://reviews.llvm.org/D55056#1314996>, @rnk wrote:

> So, one thing to keep in mind is that RelWithDebInfo is not what it looks like. If you are like me, you might think that it enables the same optimizations as a Release build and enables debug info. Unfortunately, that's incorrect. You've noticed that it uses the `/INCREMENTAL` link flag, but more importantly, it adds the `/Ob1` compile flag, which forbids the compiler from inlining functions not specifically marked `inline`. This means there are *significant* performance differences between a plain Release build and a RelWithDebInfo build, so it's not useful for profiling. To deal with this, @zturner added the `LLVM_ENABLE_PDB` option.
>
> I suppose if we want we can go down this path of trying to take things into our own hands and overriding the cmake defaults, but it seemed better to sidestep the issue and keep building in the Release configuration, which already passes `/INCREMENTAL:NO`. But, maybe if you're building from the IDE, I could see why you'd prefer to make RelWithDebInfo behave the way we expect it to.


Currently RelWithDebInfo is "//the cake is a lie//". It isn't exactly what you expect, and users might loose long hours (like I did) understanding why the build is slower, when compared to Release. You want RelWithDebInfo because you want to debug crashes in production (I wasn't aware of `LLVM_ENABLE_PDB`, thanks!).
This patch makes RelWithDebInfo //almost// equivalent to Release+PDB, except for `/Ob1` (which we could also change to `/Ob2` in RelWithDebInfo). In the past `/Ob2` was harder to debug with MSVC; but since the addition of `/d2Zi+` slash `/Zo`, optimized builds suddenly have friendlier debug streams.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55056/new/

https://reviews.llvm.org/D55056





More information about the llvm-commits mailing list