summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Linker/LinkModules.cpp5
-rw-r--r--llvm/test/Linker/ConstantGlobals3.ll2
2 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 403a1ff90c5..2692ec97b78 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -1052,9 +1052,8 @@ bool ModuleLinker::linkGlobalProto(GlobalVariable *SGV) {
if (GlobalVariable *DGVar = dyn_cast<GlobalVariable>(DGV)) {
DGVar->setAlignment(Alignment);
- if (DGVar->isDeclaration() && SGV->isConstant() &&
- !DGVar->isConstant())
- DGVar->setConstant(true);
+ if (DGVar->isDeclaration() && !SGV->isConstant())
+ DGVar->setConstant(false);
}
// Set calculated linkage, visibility and unnamed_addr.
diff --git a/llvm/test/Linker/ConstantGlobals3.ll b/llvm/test/Linker/ConstantGlobals3.ll
index 5867ea50088..0b70ddd646f 100644
--- a/llvm/test/Linker/ConstantGlobals3.ll
+++ b/llvm/test/Linker/ConstantGlobals3.ll
@@ -1,6 +1,6 @@
; RUN: llvm-link %s %S/Inputs/ConstantGlobals3.ll -S | FileCheck %s
; RUN: llvm-link %S/Inputs/ConstantGlobals3.ll %s -S | FileCheck %s
-; CHECK: @X = external constant [1 x i32]
+; CHECK: @X = external global [1 x i32]
@X = external global [1 x i32]
OpenPOWER on IntegriCloud