X86AsmBackend.cpp: #ifndef NDEBUG some only-used-in-asserts variables to fix the -Werror non-asserts build

This commit is contained in:
David Blaikie 2020-03-04 22:36:24 -08:00
parent 4b15decb60
commit 7a6878a72e
1 changed files with 4 additions and 0 deletions

View File

@ -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<MCBoundaryAlignFragment>(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