From 8a8f24b098c9d984f6155411605b0d5120e3f9d6 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 20 Apr 2016 17:53:21 +0000 Subject: [PATCH] [MC] EmitNop: Make an assertion more useful. Differential Revision: http://reviews.llvm.org/D19334 llvm-svn: 266895 --- llvm/lib/Target/X86/X86MCInstLower.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index 6a5e97b..6b42943 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -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!"); } } -- 2.7.4