Do not assert when trying to add a meta data operand with
authorPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>
Tue, 15 Oct 2013 14:18:10 +0000 (14:18 +0000)
committerPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>
Tue, 15 Oct 2013 14:18:10 +0000 (14:18 +0000)
MachineInstr::addOperand().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192707 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index a123e36e96b8a873e13a4d1e2788c2ebf6f67e0f..488516385d78f83ae21133982a05ccc2ed990a72 100644 (file)
@@ -647,11 +647,12 @@ void MachineInstr::addOperand(MachineFunction &MF, const MachineOperand &Op) {
     }
   }
 
+  bool isMetaDataOp = Op.getType() == MachineOperand::MO_Metadata;
   // OpNo now points as the desired insertion point.  Unless this is a variadic
   // instruction, only implicit regs are allowed beyond MCID->getNumOperands().
   // RegMask operands go between the explicit and implicit operands.
   assert((isImpReg || Op.isRegMask() || MCID->isVariadic() ||
-          OpNo < MCID->getNumOperands()) &&
+          OpNo < MCID->getNumOperands() || isMetaDataOp) &&
          "Trying to add an operand to a machine instr that is already done!");
 
   MachineRegisterInfo *MRI = getRegInfo();