//
for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
- GlobalVariable *GV = new GlobalVariable(M->getContext(),
+ GlobalVariable *GV = new GlobalVariable(*New,
I->getType()->getElementType(),
false,
GlobalValue::ExternalLinkage, 0,
- I->getName(), New);
+ I->getName());
GV->setAlignment(I->getAlignment());
ValueMap[I] = GV;
}
GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]);
if (I->hasInitializer())
GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(),
- ValueMap,
- &M->getContext())));
+ ValueMap)));
GV->setLinkage(I->getLinkage());
GV->setThreadLocal(I->isThreadLocal());
GV->setConstant(I->isConstant());
ValueMap[J] = DestI++;
}
- std::vector<ReturnInst*> Returns; // Ignore returns cloned...
+ SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned.
CloneFunctionInto(F, I, ValueMap, Returns);
}
GlobalAlias *GA = cast<GlobalAlias>(ValueMap[I]);
GA->setLinkage(I->getLinkage());
if (const Constant* C = I->getAliasee())
- GA->setAliasee(cast<Constant>(MapValue(C, ValueMap, &M->getContext())));
+ GA->setAliasee(cast<Constant>(MapValue(C, ValueMap)));
}
return New;