@@ -1028,30 +1028,30 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) {
1028
1028
else
1029
1029
NewGV = linkGlobalAliasProto (cast<GlobalAlias>(SGV), DGV, LinkFromSrc);
1030
1030
1031
- if (NewGV) {
1032
- if (NewGV != DGV)
1033
- copyGVAttributes (NewGV, SGV);
1031
+ if (!NewGV)
1032
+ return false ;
1034
1033
1035
- NewGV-> setUnnamedAddr (HasUnnamedAddr);
1036
- NewGV-> setVisibility (Visibility );
1034
+ if (NewGV != DGV)
1035
+ copyGVAttributes (NewGV, SGV );
1037
1036
1038
- if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) {
1039
- if (C)
1040
- NewGO->setComdat (C);
1037
+ NewGV->setUnnamedAddr (HasUnnamedAddr);
1038
+ NewGV->setVisibility (Visibility);
1041
1039
1042
- if (DGV && DGV-> hasCommonLinkage () && SGV-> hasCommonLinkage ())
1043
- NewGO-> setAlignment ( std::max (DGV-> getAlignment (), SGV-> getAlignment ()));
1044
- }
1040
+ if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) {
1041
+ if (C)
1042
+ NewGO-> setComdat (C);
1045
1043
1046
- // Make sure to remember this mapping.
1047
- if (NewGV != DGV) {
1048
- if (DGV) {
1049
- DGV->replaceAllUsesWith (
1050
- ConstantExpr::getBitCast (NewGV, DGV->getType ()));
1051
- DGV->eraseFromParent ();
1052
- }
1053
- ValueMap[SGV] = NewGV;
1044
+ if (DGV && DGV->hasCommonLinkage () && SGV->hasCommonLinkage ())
1045
+ NewGO->setAlignment (std::max (DGV->getAlignment (), SGV->getAlignment ()));
1046
+ }
1047
+
1048
+ // Make sure to remember this mapping.
1049
+ if (NewGV != DGV) {
1050
+ if (DGV) {
1051
+ DGV->replaceAllUsesWith (ConstantExpr::getBitCast (NewGV, DGV->getType ()));
1052
+ DGV->eraseFromParent ();
1054
1053
}
1054
+ ValueMap[SGV] = NewGV;
1055
1055
}
1056
1056
1057
1057
return false ;
0 commit comments