[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 4 15:26:26 PDT 2004



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.100 -> 1.101
---
Log message:

Add a hack to work around a problem my changes exposed


---
Diffs of the changes:  (+7 -0)

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.100 llvm/lib/VMCore/Constants.cpp:1.101
--- llvm/lib/VMCore/Constants.cpp:1.100	Wed Aug  4 13:50:09 2004
+++ llvm/lib/VMCore/Constants.cpp	Wed Aug  4 17:26:13 2004
@@ -608,6 +608,13 @@
     void remove(ConstantClass *CP) {
       MapIterator I = Map.find(MapKey((TypeClass*)CP->getRawType(),
                                       getValType(CP)));
+      if (I == Map.end() || I->second != CP) {
+        // FIXME: This should not use a linear scan.  If this gets to be a
+        // performance problem, someone should look at this.
+        for (I = Map.begin(); I != Map.end() && I->second != CP; ++I)
+          /* empty */;
+      }
+
       assert(I != Map.end() && "Constant not found in constant table!");
       assert(I->second == CP && "Didn't find correct element?");
 






More information about the llvm-commits mailing list