1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Don't drop alignment on globals when cloning.

llvm-svn: 57320
This commit is contained in:
Nick Lewycky 2008-10-09 06:27:14 +00:00
parent 284ae75537
commit 843c7dfe05

View File

@ -55,10 +55,14 @@ Module *llvm::CloneModule(const Module *M,
// don't worry about attributes or initializers, they will come later.
//
for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I)
ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false,
GlobalValue::ExternalLinkage, 0,
I->getName(), New);
I != E; ++I) {
GlobalVariable *GV = new GlobalVariable(I->getType()->getElementType(),
false,
GlobalValue::ExternalLinkage, 0,
I->getName(), New);
GV->setAlignment(I->getAlignment());
ValueMap[I] = GV;
}
// Loop over the functions in the module, making external functions as before
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
@ -66,7 +70,7 @@ Module *llvm::CloneModule(const Module *M,
Function::Create(cast<FunctionType>(I->getType()->getElementType()),
GlobalValue::ExternalLinkage, I->getName(), New);
NF->copyAttributesFrom(I);
ValueMap[I]= NF;
ValueMap[I] = NF;
}
// Loop over the aliases in the module