[llvm] r266895 - [MC] EmitNop: Make an assertion more useful.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 10:53:21 PDT 2016


Author: davide
Date: Wed Apr 20 12:53:21 2016
New Revision: 266895

URL: http://llvm.org/viewvc/llvm-project?rev=266895&view=rev
Log:
[MC] EmitNop: Make an assertion more useful.

Differential Revision:  http://reviews.llvm.org/D19334

Modified:
    llvm/trunk/lib/Target/X86/X86MCInstLower.cpp

Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=266895&r1=266894&r2=266895&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Wed Apr 20 12:53:21 2016
@@ -837,9 +837,10 @@ static unsigned EmitNop(MCStreamer &OS,
 /// \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!");
   }
 }
 




More information about the llvm-commits mailing list