summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormortimer <mortimer@openbsd.org>2018-06-22 12:01:07 +0000
committermortimer <mortimer@openbsd.org>2018-06-22 12:01:07 +0000
commitaac92f18378ed3e3a0cf30f3c850ff4efe475631 (patch)
treef8df4be0f0239d4f66322aa12cd754829a7572a8
parentvmm(4): Be more careful when tearing down VMs, to avoid a possible race (diff)
downloadwireguard-openbsd-aac92f18378ed3e3a0cf30f3c850ff4efe475631.tar.xz
wireguard-openbsd-aac92f18378ed3e3a0cf30f3c850ff4efe475631.zip
Emit trap alignment between basic blocks that are unrechable via
fallthrough. Avoids unnecessary jmp instructions in the middle of functions and makes disassembly nicer to read. ok guenther@ mlarkin@ deraadt@
-rw-r--r--gnu/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/gnu/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/gnu/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index cac872cada4..21bd72789cd 100644
--- a/gnu/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/gnu/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2684,11 +2684,15 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock &MBB) const {
}
}
- // Emit an alignment directive for this block, if needed.
- if (unsigned Align = MBB.getAlignment())
- EmitAlignment(Align);
MCCodePaddingContext Context;
setupCodePaddingContext(MBB, Context);
+ // Emit an alignment directive for this block, if needed.
+ if (unsigned Align = MBB.getAlignment()) {
+ if (Context.IsBasicBlockReachableViaFallthrough)
+ EmitAlignment(Align);
+ else
+ EmitTrapAlignment(Align);
+ }
OutStreamer->EmitCodePaddingBasicBlockStart(Context);
// If the block has its address taken, emit any labels that were used to