[PATCH] D49405: Change the cap on the amount of padding for each vtable to 32-byte (previously it was 128-byte)

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 14:48:31 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337622: Change the cap on the amount of padding for each vtable to 32-byte (previously… (authored by pcc, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D49405?vs=156581&id=156613#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49405

Files:
  compiler-rt/trunk/test/cfi/create-derivers.test
  llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp


Index: compiler-rt/trunk/test/cfi/create-derivers.test
===================================================================
--- compiler-rt/trunk/test/cfi/create-derivers.test
+++ compiler-rt/trunk/test/cfi/create-derivers.test
@@ -7,15 +7,15 @@
 
 RUN: %clangxx_cfi -DB32 -flto -c -o %t2.o %S/simple-fail.cpp
 RUN: opt -lowertypetests -debug-only=lowertypetests -o /dev/null %t2.o 2>&1 | FileCheck --check-prefix=B32 %s
-B32: {{1B|B@@}}: {{.*}} size 24
+B32: {{1B|B@@}}: {{.*}} size 2{{3|4}}
 B32-NOT: all-ones
 
 RUN: %clangxx_cfi -DB64 -flto -c -o %t3.o %S/simple-fail.cpp
 RUN: opt -lowertypetests -debug-only=lowertypetests -o /dev/null %t3.o 2>&1 | FileCheck --check-prefix=B64 %s
-B64: {{1B|B@@}}: {{.*}} size 54
+B64: {{1B|B@@}}: {{.*}} size 5{{3|4}}
 B64-NOT: all-ones
 
 RUN: %clangxx_cfi -DBM -flto -c -o %t4.o %S/simple-fail.cpp
 RUN: opt -lowertypetests -debug-only=lowertypetests -o /dev/null %t4.o 2>&1 | FileCheck --check-prefix=BM %s
-BM: {{1B|B@@}}: {{.*}} size 84
+BM: {{1B|B@@}}: {{.*}} size 8{{3|4}}
 BM-NOT: all-ones
Index: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -771,10 +771,12 @@
     // Compute the amount of padding required.
     uint64_t Padding = NextPowerOf2(InitSize - 1) - InitSize;
 
-    // Cap at 128 was found experimentally to have a good data/instruction
-    // overhead tradeoff.
-    if (Padding > 128)
-      Padding = alignTo(InitSize, 128) - InitSize;
+    // Experiments of different caps with Chromium on both x64 and ARM64
+    // have shown that the 32-byte cap generates the smallest binary on
+    // both platforms while different caps yield similar performance.
+    // (see https://lists.llvm.org/pipermail/llvm-dev/2018-July/124694.html)
+    if (Padding > 32)
+      Padding = alignTo(InitSize, 32) - InitSize;
 
     GlobalInits.push_back(
         ConstantAggregateZero::get(ArrayType::get(Int8Ty, Padding)));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49405.156613.patch
Type: text/x-patch
Size: 2053 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180720/4630eb26/attachment.bin>


More information about the llvm-commits mailing list