[PATCH] D101817: [MC][X86] Automatic alignment for Macro-Op Fusion

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 7 22:52:47 PDT 2021


Amir marked 2 inline comments as done.
Amir added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp:165-172
+    if (X86AlignForMacroFusion) {
+      assert(!X86AlignBranchWithin32BBoundaries &&
+             "X86AlignForMacroFusion is incompatible with "
+             "X86AlignBranchWithin32BBoundaries");
+      AlignBoundary = assumeAligned(64);
+      AlignBranchType.addKind(X86::AlignBranchFused);
+      AlignBranchType.addKind(X86::AlignBranchJcc);
----------------
skan wrote:
> In fact, X86AlignForMacroFusion is compatible with X86AlignBranchWithin32BBoundaries, you can set AlignBoundary to 64 and add  AlignBranchFused to AlignBranchType if both of the options exist.
No, they're semantically incompatible: X86AlignBranchWithin32BBoundaries would prevent macrofusion pair from crossing the 32B boundary (stronger alignment restriction), while X86AlignForMacroFusion would prevent macrofusion pair being perfectly split by 64B boundary.
So if X86AlignForMacroFusion is on, it's known not to satisfy X86AlignBranchWithin32BBoundaries restrictions. 
(Conversely, if X86AlignBranchWithin32BBoundaries is on, X86AlignForMacroFusion is satisfied automatically).

They're further incompatible by the fact that X86AlignForMacroFusion flag enables the new BoundaryAlign behavior `isAvoidEndAlign` which performs the same alignment as NeverAlign.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101817



More information about the llvm-commits mailing list