Avoid adding a null MD node operand, which crashes with "-debug" when trying
authorBob Wilson <bob.wilson@apple.com>
Mon, 26 Apr 2010 22:56:56 +0000 (22:56 +0000)
committerBob Wilson <bob.wilson@apple.com>
Mon, 26 Apr 2010 22:56:56 +0000 (22:56 +0000)
to print the operand.

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

lib/CodeGen/SelectionDAG/InstrEmitter.cpp

index 1afca3debf8858c58361bce81568631c9a6a70d7..f857a1c89420a32a25ed26aac26e2ef249fc32fb 100644 (file)
@@ -769,7 +769,8 @@ EmitSpecialNode(SDNode *Node, bool IsClone, bool IsCloned,
     // Get the mdnode from the asm if it exists and add it to the instruction.
     SDValue MDV = Node->getOperand(InlineAsm::Op_MDNode);
     const MDNode *MD = cast<MDNodeSDNode>(MDV)->getMD();
-    MI->addOperand(MachineOperand::CreateMetadata(MD));
+    if (MD)
+      MI->addOperand(MachineOperand::CreateMetadata(MD));
     
     MBB->insert(InsertPos, MI);
     break;