[llvm-commits] [llvm] r102395 - /llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Bob Wilson bob.wilson at apple.com
Mon Apr 26 15:56:56 PDT 2010


Author: bwilson
Date: Mon Apr 26 17:56:56 2010
New Revision: 102395

URL: http://llvm.org/viewvc/llvm-project?rev=102395&view=rev
Log:
Avoid adding a null MD node operand, which crashes with "-debug" when trying
to print the operand.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=102395&r1=102394&r2=102395&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Mon Apr 26 17:56:56 2010
@@ -769,7 +769,8 @@
     // 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;





More information about the llvm-commits mailing list