diff options
author | Shengchen Kan <shengchen.kan@intel.com> | 2020-04-10 18:37:24 +0800 |
---|---|---|
committer | Shengchen Kan <shengchen.kan@intel.com> | 2020-04-11 11:30:15 +0800 |
commit | 5d73f79c54788bc07dabe9ed75c36f12bafe9d28 (patch) | |
tree | 57beb742b380919d46825af84d7d1887c7665f72 /llvm/lib/MC/MCObjectStreamer.cpp | |
parent | c610807afe50b87ebebb390dbc37199e76b755d9 (diff) | |
download | llvm-5d73f79c54788bc07dabe9ed75c36f12bafe9d28.zip llvm-5d73f79c54788bc07dabe9ed75c36f12bafe9d28.tar.gz llvm-5d73f79c54788bc07dabe9ed75c36f12bafe9d28.tar.bz2 |
[X86][MC] Make -x86-pad-max-prefix-size compatible with --mc-relax-all
Summary: We allow non-relaxable instructions emitted into relaxable Fragment when we prefix padding branch. So we need to check if the instruction need relaxation before relaxing it. Without this patch, it currently triggers a `report_fatal_error` in `llvm::MCAsmBackend::relaxInstruction` when we prefix padding branch along with `--mc-relax-all`.
Reviewers: LuoYuanke, reames, MaskRay
Reviewed By: MaskRay
Subscribers: MaskRay, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77851
Diffstat (limited to 'llvm/lib/MC/MCObjectStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 3cb3faa..3549280 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -399,8 +399,7 @@ void MCObjectStreamer::emitInstructionImpl(const MCInst &Inst, // fragment. if (Assembler.getRelaxAll() || (Assembler.isBundlingEnabled() && Sec->isBundleLocked())) { - MCInst Relaxed; - getAssembler().getBackend().relaxInstruction(Inst, STI, Relaxed); + MCInst Relaxed = Inst; while (getAssembler().getBackend().mayNeedRelaxation(Relaxed, STI)) getAssembler().getBackend().relaxInstruction(Relaxed, STI, Relaxed); EmitInstToData(Relaxed, STI); |