Fix PR215: [bcwriter] Problem compactifying ConstantPointerRefs
authorChris Lattner <sabre@nondot.org>
Mon, 9 Feb 2004 00:15:41 +0000 (00:15 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 9 Feb 2004 00:15:41 +0000 (00:15 +0000)
Have I ever mentioned how much I _hate_ constantpointerrefs?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11212 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Writer/SlotCalculator.cpp
lib/VMCore/SlotCalculator.cpp

index d928c083926424a6054fa4acafdc98f922315014..7b18a1dfd5aab0e63d613a8c375abca86fb1c8c7 100644 (file)
@@ -381,6 +381,8 @@ static inline bool hasNullValue(unsigned TyID) {
 /// getOrCreateCompactionTableSlot - This method is used to build up the initial
 /// approximation of the compaction table.
 unsigned SlotCalculator::getOrCreateCompactionTableSlot(const Value *V) {
+  if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V))
+    V = CPR->getValue();
   std::map<const Value*, unsigned>::iterator I =
     CompactionNodeMap.lower_bound(V);
   if (I != CompactionNodeMap.end() && I->first == V)
index d928c083926424a6054fa4acafdc98f922315014..7b18a1dfd5aab0e63d613a8c375abca86fb1c8c7 100644 (file)
@@ -381,6 +381,8 @@ static inline bool hasNullValue(unsigned TyID) {
 /// getOrCreateCompactionTableSlot - This method is used to build up the initial
 /// approximation of the compaction table.
 unsigned SlotCalculator::getOrCreateCompactionTableSlot(const Value *V) {
+  if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V))
+    V = CPR->getValue();
   std::map<const Value*, unsigned>::iterator I =
     CompactionNodeMap.lower_bound(V);
   if (I != CompactionNodeMap.end() && I->first == V)