[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 3 17:30:01 PST 2003


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.101 -> 1.102

---
Log message:

Fix bug: Assembler/2003-03-03-DuplicateConstant.ll 


---
Diffs of the changes:

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.101 llvm/lib/AsmParser/llvmAsmParser.y:1.102
--- llvm/lib/AsmParser/llvmAsmParser.y:1.101	Sun Feb  2 10:40:20 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y	Mon Mar  3 17:28:55 2003
@@ -501,10 +501,12 @@
 
     // 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 @@
 
 // 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





More information about the llvm-commits mailing list