diff options
author | Chris Lattner <sabre@nondot.org> | 2003-03-03 23:28:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-03-03 23:28:55 +0000 |
commit | adf99700a70bdc6a50651466f312dff7585391b5 (patch) | |
tree | 54509fd48766d41078c9df00e595666c0b6e18ba /lib | |
parent | 319d05bff47946d1a77bfea0b9909e8516f67289 (diff) | |
download | external_llvm-adf99700a70bdc6a50651466f312dff7585391b5.zip external_llvm-adf99700a70bdc6a50651466f312dff7585391b5.tar.gz external_llvm-adf99700a70bdc6a50651466f312dff7585391b5.tar.bz2 |
Fix bug: Assembler/2003-03-03-DuplicateConstant.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index fd86d50..f2135a7 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -501,10 +501,12 @@ static bool setValueName(Value *V, char *NameStr) { // Otherwise, we are a simple redefinition of a value, check to see if it // is defined the same as the old one... - if (const Type *Ty = dyn_cast<const Type>(Existing)) { - if (Ty == cast<const Type>(V)) return true; // Yes, it's equal. + if (const Type *Ty = dyn_cast<Type>(Existing)) { + if (Ty == cast<Type>(V)) return true; // Yes, it's equal. // std::cerr << "Type: " << Ty->getDescription() << " != " // << cast<const Type>(V)->getDescription() << "!\n"; + } else if (const Constant *C = dyn_cast<Constant>(Existing)) { + if (C == V) return true; // Constants are equal to themselves } else if (GlobalVariable *EGV = dyn_cast<GlobalVariable>(Existing)) { // We are allowed to redefine a global variable in two circumstances: // 1. If at least one of the globals is uninitialized or @@ -1097,8 +1099,8 @@ FunctionList : FunctionList Function { // ConstPool - Constants with optional names assigned to them. ConstPool : ConstPool OptAssign CONST ConstVal { - if (setValueName($4, $2)) { assert(0 && "No redefinitions allowed!"); } - InsertValue($4); + if (!setValueName($4, $2)) + InsertValue($4); } | ConstPool OptAssign TYPE TypesV { // Types can be defined in the const pool // Eagerly resolve types. This is not an optimization, this is a |