aboutsummaryrefslogtreecommitdiff
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-02 16:40:20 +0000
committerChris Lattner <sabre@nondot.org>2003-02-02 16:40:20 +0000
commitbb3e5d4f6e749c5ebd539a437f5ed4380635bcd4 (patch)
tree9c1be21cc61877533ebe825879dab5a8c7032bce /lib/AsmParser
parente58ee96b08a9c73a202bb05caadd8d39198fc9a2 (diff)
Fix bug: Assembler/2003-02-02-ConstGlobal.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/llvmAsmParser.y12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 1189bb3706..fd86d50ead 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -510,16 +510,16 @@ static bool setValueName(Value *V, char *NameStr) {
// 1. If at least one of the globals is uninitialized or
// 2. If both initializers have the same value.
//
- // This can only be done if the const'ness of the vars is the same.
- //
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
- if (EGV->isConstant() == GV->isConstant() &&
- (!EGV->hasInitializer() || !GV->hasInitializer() ||
- EGV->getInitializer() == GV->getInitializer())) {
+ if (!EGV->hasInitializer() || !GV->hasInitializer() ||
+ EGV->getInitializer() == GV->getInitializer()) {
- // Make sure the existing global version gets the initializer!
+ // Make sure the existing global version gets the initializer! Make
+ // sure that it also gets marked const if the new version is.
if (GV->hasInitializer() && !EGV->hasInitializer())
EGV->setInitializer(GV->getInitializer());
+ if (GV->isConstant())
+ EGV->setConstant(true);
delete GV; // Destroy the duplicate!
return true; // They are equivalent!