[PATCH] D159548: [BOLT][AArch64] Fix CI alignment

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 23:32:31 PDT 2023


yota9 created this revision.
yota9 added reviewers: maksfb, rafauler, Amir.
Herald added subscribers: treapster, ayermolo, kristof.beyls.
Herald added a project: All.
yota9 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fix alignment calculation for CI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159548

Files:
  bolt/lib/Passes/Aligner.cpp


Index: bolt/lib/Passes/Aligner.cpp
===================================================================
--- bolt/lib/Passes/Aligner.cpp
+++ bolt/lib/Passes/Aligner.cpp
@@ -158,25 +158,27 @@
     BinaryContext::IndependentCodeEmitter Emitter =
         BC.createIndependentMCCodeEmitter();
 
-    if (opts::UseCompactAligner)
-      alignCompact(BF, Emitter.MCE.get());
-    else
-      alignMaxBytes(BF);
-
     // Align objects that contains constant islands and no code
     // to at least 8 bytes.
     if (!BF.size() && BF.hasIslandsInfo()) {
-      const uint16_t Alignment = BF.getConstantIslandAlignment();
-      if (BF.getAlignment() < Alignment)
-        BF.setAlignment(Alignment);
-
-      if (BF.getMaxAlignmentBytes() < Alignment)
-        BF.setMaxAlignmentBytes(Alignment);
-
-      if (BF.getMaxColdAlignmentBytes() < Alignment)
-        BF.setMaxColdAlignmentBytes(Alignment);
+      uint16_t Alignment = BF.getConstantIslandAlignment();
+      // Check if we're forcing output alignment and it is greater than minimal
+      // CI required one
+      if (!opts::UseCompactAligner && Alignment < opts::AlignFunctions &&
+          opts::AlignFunctions <= opts::AlignFunctionsMaxBytes)
+        Alignment = opts::AlignFunctions;
+
+      BF.setAlignment(Alignment);
+      BF.setMaxAlignmentBytes(Alignment);
+      BF.setMaxColdAlignmentBytes(Alignment);
+      return;
     }
 
+    if (opts::UseCompactAligner)
+      alignCompact(BF, Emitter.MCE.get());
+    else
+      alignMaxBytes(BF);
+
     if (opts::AlignBlocks && !opts::PreserveBlocksAlignment)
       alignBlocks(BF, Emitter.MCE.get());
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159548.557389.patch
Type: text/x-patch
Size: 1623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230927/7b582ff9/attachment.bin>


More information about the llvm-commits mailing list