[PATCH] D143159: [SanitizerBinaryMetadata] Treat constant globals and non-escaping addresses specially

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 03:23:26 PST 2023


dvyukov added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp:383
+      !PointerMayBeCaptured(Addr, true, true)) {
+    // The addressable object is on the stack and does not escape.
+    return false;
----------------
melver wrote:
> dvyukov wrote:
> > What if we pretend these are atomic as well?
> Marking things as atomic increases binary size. It's better to just not emit any metadata (less space used).
> 
> There are plenty function-local objects and if we mark all accesses to them as atomic, we'll end up with larger binaries.
> 
> Of course this will only help if all accesses in a function are non-escaping. If there's at least e.g. 1 global access, the function will end up being "covered" with atomics metadata again.
But I think it's highly-likely a function also contains non-local accesses (esp for optimized builds with inlining where functions tend to be larger).
Maybe we should skip functions that contain only atomics accesses and local/non-interesting accesses (contains at least 1 interesting access).



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143159



More information about the llvm-commits mailing list