aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r--lib/Linker/LinkModules.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 279c4be..7f441b0 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -395,8 +395,12 @@ static Value *RemapOperand(const Value *In,
} else if (const MDNode *MD = dyn_cast<MDNode>(In)) {
if (MD->isFunctionLocal()) {
SmallVector<Value*, 4> Elts;
- for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i)
- Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap));
+ for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) {
+ if (MD->getOperand(i))
+ Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap));
+ else
+ Elts.push_back(NULL);
+ }
Result = MDNode::get(In->getContext(), Elts.data(), MD->getNumOperands());
} else {
Result = const_cast<Value*>(In);