This repository was archived by the owner on Sep 2, 2018. It is now read-only.
File tree 1 file changed +9
-14
lines changed
1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -1045,6 +1045,14 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) {
1045
1045
NewGO->setAlignment (std::max (DGV->getAlignment (), SGV->getAlignment ()));
1046
1046
}
1047
1047
1048
+ if (auto *NewGVar = dyn_cast<GlobalVariable>(NewGV)) {
1049
+ auto *DGVar = dyn_cast_or_null<GlobalVariable>(DGV);
1050
+ auto *SGVar = dyn_cast<GlobalVariable>(SGV);
1051
+ if (DGVar && SGVar && DGVar->isDeclaration () && SGVar->isDeclaration () &&
1052
+ (!DGVar->isConstant () || !SGVar->isConstant ()))
1053
+ NewGVar->setConstant (false );
1054
+ }
1055
+
1048
1056
// Make sure to remember this mapping.
1049
1057
if (NewGV != DGV) {
1050
1058
if (DGV) {
@@ -1062,21 +1070,8 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) {
1062
1070
GlobalValue *ModuleLinker::linkGlobalVariableProto (const GlobalVariable *SGVar,
1063
1071
GlobalValue *DGV,
1064
1072
bool LinkFromSrc) {
1065
- bool ClearConstant = false ;
1066
-
1067
- if (DGV) {
1068
- auto *DGVar = dyn_cast<GlobalVariable>(DGV);
1069
- if (!SGVar->isConstant () || (DGVar && !DGVar->isConstant ()))
1070
- ClearConstant = true ;
1071
- }
1072
-
1073
- if (!LinkFromSrc) {
1074
- if (auto *NewGVar = dyn_cast<GlobalVariable>(DGV)) {
1075
- if (NewGVar->isDeclaration () && ClearConstant)
1076
- NewGVar->setConstant (false );
1077
- }
1073
+ if (!LinkFromSrc)
1078
1074
return DGV;
1079
- }
1080
1075
1081
1076
// No linking to be performed or linking from the source: simply create an
1082
1077
// identical version of the symbol over in the dest module... the
You can’t perform that action at this time.
0 commit comments