[PATCH] D69428: [GlobalOpt] Remove valgrind specific hacks (revert r160529)

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 21:12:08 PDT 2021


mehdi_amini added a comment.

In D69428#2687701 <https://reviews.llvm.org/D69428#2687701>, @MaskRay wrote:

> In D69428#2687680 <https://reviews.llvm.org/D69428#2687680>, @mehdi_amini wrote:
>
>> In D69428#2687530 <https://reviews.llvm.org/D69428#2687530>, @MaskRay wrote:
>>
>>> `clang++ -O1 a.cc b.cc -fsanitize=leak` had no leak before and reported a leak with this patch. You can also change -O1 to -O2 or -O3. `-fsanitize=leak` can be changed to `-fsanitize=address`. You may remove -fsanitize= and use valgrind.
>>
>> I'd question whether this is a feature or a bug though: if a user really want to intentionally "leak" this way, they could mark the `static void *g;` with `__attribute__((__used__))` to prevent the optimization, or make the store volatile.
>
> The loads can be optimized out, so I don't think the user needs annotation.

Can you expand on why the store shouldn't be optimized? I understand it breaks leak checker, but that does not make it a bug...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69428



More information about the llvm-commits mailing list