[PATCH] D70157: Align branches within 32-Byte boundary

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 17:49:07 PST 2019


xiangzhangllvm added a comment.

In D70157#1746793 <https://reviews.llvm.org/D70157#1746793>, @MaskRay wrote:

> On x86, the preferred function alignment is 16 (https://github.com/llvm/llvm-project/blob/arcpatch-D70157/llvm/lib/Target/X86/X86ISelLowering.cpp#L1893), which is the default function alignment in text sections. If the cross-boundary decision is made with alignment=32 (--x86-align-branch-boundary=32) in mind, and the section alignment is still 16 (not increased to 32 or higher), the linker may place the section at an address which equals 16 modulo 32, the section contents will thus shift by 16. The instructions that do not cross the boundary in the object files may cross the boundary in the linker output. Have you considered increasing the section alignment to 32?
>
> Shall we default to -mbranches-within-32B-boundaries if the specified -march= or -mtune= may be affected by the erratum?


Hi Fangrui, Here will set the section alignment to 32, llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp:658


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70157





More information about the llvm-commits mailing list