[MC] EmitNop: Make an assertion more useful.
authorDavide Italiano <davide@freebsd.org>
Wed, 20 Apr 2016 17:53:21 +0000 (17:53 +0000)
committerDavide Italiano <davide@freebsd.org>
Wed, 20 Apr 2016 17:53:21 +0000 (17:53 +0000)
Differential Revision:  http://reviews.llvm.org/D19334

llvm-svn: 266895

llvm/lib/Target/X86/X86MCInstLower.cpp

index 6a5e97b..6b42943 100644 (file)
@@ -837,9 +837,10 @@ static unsigned EmitNop(MCStreamer &OS, unsigned NumBytes, bool Is64Bit,
 /// \brief Emit the optimal amount of multi-byte nops on X86.
 static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit,
                      const MCSubtargetInfo &STI) {
+  unsigned NopsToEmit = NumBytes;
   while (NumBytes) {
     NumBytes -= EmitNop(OS, NumBytes, Is64Bit, STI);
-    assert(NumBytes >= 0 && "Emitted more than I asked for!");
+    assert(NopsToEmit >= NumBytes && "Emitted more than I asked for!");
   }
 }