No need to map NULL operands of metadata
authorVictor Hernandez <vhernandez@apple.com>
Thu, 21 Jan 2010 19:26:20 +0000 (19:26 +0000)
committerVictor Hernandez <vhernandez@apple.com>
Thu, 21 Jan 2010 19:26:20 +0000 (19:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94091 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/ValueMapper.cpp

index e3ef79facc73465e851b727fef3621b16162260f..2a79b72ba1dd5abd3c8d869a613c6bfc0d2c215d 100644 (file)
@@ -39,7 +39,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
     const MDNode *MD = dyn_cast<MDNode>(V);
     SmallVector<Value*, 4> Elts;
     for (unsigned i = 0; i != MD->getNumOperands(); i++)
-      Elts.push_back(MapValue(MD->getOperand(i), VM));
+      Elts.push_back(MD->getOperand(i) ? MapValue(MD->getOperand(i), VM) : NULL);
     return VM[V] = MDNode::get(V->getContext(), Elts.data(), Elts.size());
   }