[llvm] [BOLT] Add heuristics to determine constant island's alignment (PR #159486)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 25 13:03:56 PDT 2025
================
@@ -284,6 +284,33 @@ BinaryFunction::getBasicBlockContainingOffset(uint64_t Offset) {
return (Offset < BB->getOffset() + BB->getOriginalSize()) ? BB : nullptr;
}
+uint16_t BinaryFunction::getConstantIslandAlignment() const {
+ if (Islands == nullptr)
+ return 1;
+
+ // For constant island inside a function, the default 8-byte alignment is
+ // probably good enough.
+ const uint16_t DefaultAlignment = sizeof(uint64_t);
+ if (!isDataObject())
+ return DefaultAlignment;
+
+ // If the constant island itself is a binary function, get its alignment
+ // based on its size, original address, and its owning section's alignment.
+ uint64_t MaxAlignment =
----------------
maksfb wrote:
nit: constify variables that don't change.
https://github.com/llvm/llvm-project/pull/159486
More information about the llvm-commits
mailing list