1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Link the type of aliases.

They are not more or less "well typed" than GlobalVariables.

llvm-svn: 222725
This commit is contained in:
Rafael Espindola 2014-11-25 04:43:59 +00:00
parent 2f4773263d
commit 906b92c9d0
3 changed files with 19 additions and 2 deletions

View File

@ -786,6 +786,11 @@ void ModuleLinker::computeTypeMapping() {
TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
}
for (GlobalValue &SGV : SrcM->aliases()) {
if (GlobalValue *DGV = getLinkedToGlobal(&SGV))
TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
}
// Incorporate types by name, scanning all the types in the source module.
// At this point, the destination module may have a type "%foo = { i32 }" for
// example. When the source module got loaded into the same LLVMContext, if
@ -829,8 +834,6 @@ void ModuleLinker::computeTypeMapping() {
TypeMap.addTypeMapping(DST, ST);
}
// Don't bother incorporating aliases, they aren't generally typed well.
// Now that we have discovered all of the type equivalences, get a body for
// any 'opaque' types in the dest module that are now resolved.
TypeMap.linkDefinedTypeBodies();

View File

@ -0,0 +1,4 @@
%u = type { i8 }
@g2 = global %u zeroinitializer
@a = weak alias %u* @g2

View File

@ -0,0 +1,10 @@
; RUN: llvm-link -S %s %p/Inputs/type-unique-alias.ll | FileCheck %s
%t = type { i8 }
@g = global %t zeroinitializer
@a = weak alias %t* @g
; CHECK: @g = global %t zeroinitializer
; CHECK: @g2 = global %t zeroinitializer
; CHECK: @a = weak alias %t* @g