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

David Zarzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 05:16:50 PST 2019


davezarzycki 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?


That isn't good enough. Even though core2 isn't affected by the erratum, core2 code can run on CPUs that do have the bug (and core2 is a popular target for code that needs to run "everywhere"), therefore all target CPUs that predate a hardware fix really ought to have -mbranches-within-32B-boundaries by default.


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

https://reviews.llvm.org/D70157





More information about the llvm-commits mailing list