diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp index e56c049f2442..88487f57e5e5 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -820,7 +820,9 @@ void X86AsmBackend::finishLayout(MCAssembler const &Asm, continue; } +#ifndef NDEBUG const uint64_t OrigOffset = Layout.getFragmentOffset(&F); +#endif const uint64_t OrigSize = Asm.computeFragmentSize(Layout, F); if (OrigSize == 0 || Relaxable.empty()) { Relaxable.clear(); @@ -863,11 +865,13 @@ void X86AsmBackend::finishLayout(MCAssembler const &Asm, if (F.getKind() == MCFragment::FT_BoundaryAlign) cast(F).setSize(RemainingSize); +#ifndef NDEBUG const uint64_t FinalOffset = Layout.getFragmentOffset(&F); const uint64_t FinalSize = Asm.computeFragmentSize(Layout, F); assert(OrigOffset + OrigSize == FinalOffset + FinalSize && "can't move start of next fragment!"); assert(FinalSize == RemainingSize && "inconsistent size computation?"); +#endif // If we're looking at a boundary align, make sure we don't try to pad // its target instructions for some following directive. Doing so would