[X86] Reduce the number of emitted fragments due to branch align
authorShengchen Kan <shengchen.kan@intel.com>
Tue, 3 Mar 2020 08:54:23 +0000 (16:54 +0800)
committerShengchen Kan <shengchen.kan@intel.com>
Thu, 12 Mar 2020 07:37:35 +0000 (15:37 +0800)
commit3a503ce66318ed65d071f6401af5750640d33444
treeeebc34cf9cee3a6e109827db554f20c8e9cf5d77
parent629cf3c1c5204c27ed2a999452c12716e4b7f2b6
[X86] Reduce the number of emitted fragments due to branch align

Summary:
Currently, a BoundaryAlign fragment may be inserted after the branch
that needs to be aligned to truncate the current fragment, this fragment is
unused at most of time. To avoid that, we can insert a new empty Data
fragment instead. Non-relaxable instruction is usually emitted into Data
fragment, so the inserted empty Data fragment will be reused at a high
possibility.

Reviewers: annita.zhang, reames, MaskRay, craig.topper, LuoYuanke, jyknight

Reviewed By: reames, LuoYuanke

Subscribers: llvm-commits, dexonsmith, hiraditya

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75438
llvm/include/llvm/MC/MCFragment.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCFragment.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/test/MC/X86/align-branch-64-negative.s