[PATCH] D138674: [Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 24 08:08:24 PST 2022


gchatelet marked an inline comment as done.
gchatelet added inline comments.


================
Comment at: bolt/lib/Core/BinaryEmitter.cpp:798
     Streamer.switchSection(JT.Count > 0 ? HotSection : ColdSection);
-    Streamer.emitValueToAlignment(JT.EntrySize);
+    Streamer.emitValueToAlignment(Align(JT.EntrySize));
   }
----------------
courbet wrote:
> I don;t think there is really anything guaranteeing that this is a power of 2 , but it looks like it's the case all targets upstream.
Looks like relevant code is here.
https://github.com/llvm/llvm-project/blob/b9e3f5f864fb1944be60725aca400a9332ac6aa5/bolt/include/bolt/Core/BinaryContext.h#L377-L380

I think it's fine to assume it's aligned. If it changes `Align` ctor will assert and a proper fix can be applied.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138674



More information about the llvm-commits mailing list