[all-commits] [llvm/llvm-project] c68a9d: [ASan][libc++] String annotations optimizations fi...
Tacet via All-commits
all-commits at lists.llvm.org
Mon Jan 8 09:02:32 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c68a9d25e99a096f6862fc4b57dd380a21245d31
https://github.com/llvm/llvm-project/commit/c68a9d25e99a096f6862fc4b57dd380a21245d31
Author: Tacet <advenam.tacet at trailofbits.com>
Date: 2024-01-08 (Mon, 08 Jan 2024)
Changed paths:
M libcxx/include/string
Log Message:
-----------
[ASan][libc++] String annotations optimizations fix with lambda (#76200)
This commit addresses optimization and instrumentation challenges
encountered within comma constructors.
1) _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS does not work in comma
constructors.
2) Code inside comma constructors is not always correctly optimized.
Problematic code examples:
- `: __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)),
std::move(__str.__r_))) {`
- `: __r_(__r_([&](){ if(!__s.__is_long()) __s.__annotate_delete();
return std::move(__s.__r_);}())) {`
However, lambda with argument seems to be correctly optimized. The patch employs this.
Use of lambda based on an idea from @ldionne.
More information about the All-commits
mailing list