No need to map NULL operands of metadata

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Victor Hernandez 2010-01-21 19:26:20 +00:00
parent e40eb09e5e
commit f42fae1674

View File

@ -39,7 +39,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
const MDNode *MD = dyn_cast<MDNode>(V); const MDNode *MD = dyn_cast<MDNode>(V);
SmallVector<Value*, 4> Elts; SmallVector<Value*, 4> Elts;
for (unsigned i = 0; i != MD->getNumOperands(); i++) 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()); return VM[V] = MDNode::get(V->getContext(), Elts.data(), Elts.size());
} }