Add a hack to work around a problem my changes exposed
authorChris Lattner <sabre@nondot.org>
Wed, 4 Aug 2004 22:26:13 +0000 (22:26 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 4 Aug 2004 22:26:13 +0000 (22:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15509 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp

index b65758b7dd504f7aecef7f32b2b3fc246d154bfa..bc274f0e3242d24e142b3e14451204c515ee94b0 100644 (file)
@@ -608,6 +608,13 @@ namespace {
     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?");