[libcxx-commits] [PATCH] D108389: [libc++] Bypass calling exception-throwing functions in the dylib with -fno-exceptions
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 22 11:23:21 PDT 2021
ldionne added a comment.
In D108389#3015964 <https://reviews.llvm.org/D108389#3015964>, @rupprecht wrote:
> One interesting cleanup was a test failure like this (pseudocode-ish):
>
> auto lambda = [&]() {
> std::vector<int> foo;
> foo.resize(100);
> };
> auto memory_used = InvokeAndMeasureMemory(lambda);
> EXPECT_EQ(memory_used, 800);
>
> This started failing because `memory_used` is now 0 after this commit. IIUC, having more declarations available in the header gave the optimizer more information that led to completely getting rid of the `std::vector` usage, so it's an empty lambda.
>
> We had another one that's way too complicated to explain here, but it was another case of "more information = better optimization = test failure because a test asserts fragile things". In general I wouldn't expect this to make a very performance impact, but it's on the positive side of zero.
Thanks a lot for the feedback, this is quite interesting indeed. I would expect that's because `resize()` doesn't make an external call to a function defined in the library anymore, and now the optimizer can reason better about things. It's not clear to me it would make a difference in the general case, but oh well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108389/new/
https://reviews.llvm.org/D108389
More information about the libcxx-commits
mailing list