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

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


Author: pcc
Date: Fri Jul 20 14:43:20 2018
New Revision: 337622

URL: http://llvm.org/viewvc/llvm-project?rev=337622&view=rev
Log:
Change the cap on the amount of padding for each vtable to 32-byte (previously it was 128-byte)

We tested different cap values with a recent commit of Chromium. Our results show that the 32-byte cap yields the smallest binary and all the caps yield similar performance.
Based on the results, we propose to change the cap value to 32-byte.

Patch by Zhaomo Yang!

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

Modified:
    llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp

Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=337622&r1=337621&r2=337622&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Fri Jul 20 14:43:20 2018
@@ -771,10 +771,12 @@ void LowerTypeTestsModule::buildBitSetsF
     // 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)));




More information about the llvm-commits mailing list