From b22ba044c1ac91e28aab30e78bb8a8ae91e06d1d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 4 Aug 2004 22:26:13 +0000 Subject: [PATCH] Add a hack to work around a problem my changes exposed llvm-svn: 15509 --- lib/VMCore/Constants.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index b65758b7dd5..bc274f0e324 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -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?");