[llvm-branch-commits] [compiler-rt] a779050 - scudo: Shrink secondary header and cache entry size by a word on Linux. NFCI.

Peter Collingbourne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 9 14:19:28 PST 2020


Author: Peter Collingbourne
Date: 2020-12-09T14:14:49-08:00
New Revision: a7790508522fc277963df974dc953077778e3c11

URL: https://github.com/llvm/llvm-project/commit/a7790508522fc277963df974dc953077778e3c11
DIFF: https://github.com/llvm/llvm-project/commit/a7790508522fc277963df974dc953077778e3c11.diff

LOG: scudo: Shrink secondary header and cache entry size by a word on Linux. NFCI.

Normally compilers will allocate space for struct fields even if the
field is an empty struct. Use the [[no_unique_address]] attribute to
suppress that behavior. This attribute that was introduced in C++20,
but compilers that do not support [[no_unique_address]] will ignore
it since it uses C++11 attribute syntax.

Differential Revision: https://reviews.llvm.org/D92966

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/secondary.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index eda88862cb07..ff41bd3e0722 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -31,7 +31,7 @@ struct Header {
   uptr BlockEnd;
   uptr MapBase;
   uptr MapSize;
-  MapPlatformData Data;
+  [[no_unique_address]] MapPlatformData Data;
 };
 
 constexpr uptr getHeaderSize() {
@@ -232,7 +232,7 @@ class MapAllocatorCache {
     uptr BlockEnd;
     uptr MapBase;
     uptr MapSize;
-    MapPlatformData Data;
+    [[no_unique_address]] MapPlatformData Data;
     u64 Time;
   };
 


        


More information about the llvm-branch-commits mailing list