X86: only access operands if they are present
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 14 Jan 2015 05:37:10 +0000 (05:37 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 14 Jan 2015 05:37:10 +0000 (05:37 +0000)
If there is no associated immediate (MS style inline asm), do not try to access
the operand, assume that it is valid.  This should fix the buildbots after SVN
r225941.

llvm-svn: 225950

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

index 2882448..02d4847 100644 (file)
@@ -2277,6 +2277,8 @@ bool X86AsmParser::validateInstruction(MCInst &Inst, const OperandVector &Ops) {
   switch (Inst.getOpcode()) {
   default: return true;
   case X86::INT:
+    if (Inst.getNumOperands() == 0)
+      return true;
     assert(Inst.getOperand(0).isImm() && "expected immediate");
     if (Inst.getOperand(0).getImm() > 255) {
       Error(Ops[1]->getStartLoc(), "interrupt vector must be in range [0-255]");