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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 22:37:15 PST 2020


Author: David Blaikie
Date: 2020-03-04T22:36:24-08:00
New Revision: 7a6878a72ec4168434103b7461065a500754861d

URL: https://github.com/llvm/llvm-project/commit/7a6878a72ec4168434103b7461065a500754861d
DIFF: https://github.com/llvm/llvm-project/commit/7a6878a72ec4168434103b7461065a500754861d.diff

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

Added: 
    

Modified: 
    llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Removed: 
    


################################################################################
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<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


        


More information about the llvm-commits mailing list