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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 20:45:39 PDT 2021


MaskRay added a comment.

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.


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