llvm.org GIT mirror llvm / 453ce91
Link the type of aliases. They are not more or less "well typed" than GlobalVariables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222725 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
3 changed file(s) with 19 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
785785 TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
786786 }
787787
788 for (GlobalValue &SGV : SrcM->aliases()) {
789 if (GlobalValue *DGV = getLinkedToGlobal(&SGV))
790 TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
791 }
792
788793 // Incorporate types by name, scanning all the types in the source module.
789794 // At this point, the destination module may have a type "%foo = { i32 }" for
790795 // example. When the source module got loaded into the same LLVMContext, if
828833 TypeMap.addTypeMapping(DST, ST);
829834 }
830835
831 // Don't bother incorporating aliases, they aren't generally typed well.
832
833836 // Now that we have discovered all of the type equivalences, get a body for
834837 // any 'opaque' types in the dest module that are now resolved.
835838 TypeMap.linkDefinedTypeBodies();
0 %u = type { i8 }
1
2 @g2 = global %u zeroinitializer
3 @a = weak alias %u* @g2
0 ; RUN: llvm-link -S %s %p/Inputs/type-unique-alias.ll | FileCheck %s
1
2 %t = type { i8 }
3
4 @g = global %t zeroinitializer
5 @a = weak alias %t* @g
6
7 ; CHECK: @g = global %t zeroinitializer
8 ; CHECK: @g2 = global %t zeroinitializer
9 ; CHECK: @a = weak alias %t* @g