mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-23 22:23:00 +00:00
Move copying of global initializers below the cloning of functions.
The BlockAddress doesn't have access to the correct basic blocks until the functions have been cloned. This causes the BlockAddress to point to the old values. Just wait until the functions have been cloned before copying the initializers. PR13163 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194218 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1251,10 +1251,6 @@ bool ModuleLinker::run() {
|
||||
for (unsigned i = 0, e = AppendingVars.size(); i != e; ++i)
|
||||
linkAppendingVarInit(AppendingVars[i]);
|
||||
|
||||
// Update the initializers in the DstM module now that all globals that may
|
||||
// be referenced are in DstM.
|
||||
linkGlobalInits();
|
||||
|
||||
// Link in the function bodies that are defined in the source module into
|
||||
// DstM.
|
||||
for (Module::iterator SF = SrcM->begin(), E = SrcM->end(); SF != E; ++SF) {
|
||||
@@ -1336,6 +1332,10 @@ bool ModuleLinker::run() {
|
||||
}
|
||||
} while (LinkedInAnyFunctions);
|
||||
|
||||
// Update the initializers in the DstM module now that all globals that may
|
||||
// be referenced are in DstM.
|
||||
linkGlobalInits();
|
||||
|
||||
// Now that all of the types from the source are used, resolve any structs
|
||||
// copied over to the dest that didn't exist there.
|
||||
TypeMap.linkDefinedTypeBodies();
|
||||
|
||||
Reference in New Issue
Block a user