From: Chris Lattner Date: Mon, 9 Feb 2004 00:15:41 +0000 (+0000) Subject: Fix PR215: [bcwriter] Problem compactifying ConstantPointerRefs X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=71151aee60d785aebefb0b4cdf085469d4a696a4;p=oota-llvm.git Fix PR215: [bcwriter] Problem compactifying ConstantPointerRefs 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 --- diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index d928c083926..7b18a1dfd5a 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -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(V)) + V = CPR->getValue(); std::map::iterator I = CompactionNodeMap.lower_bound(V); if (I != CompactionNodeMap.end() && I->first == V) diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index d928c083926..7b18a1dfd5a 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -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(V)) + V = CPR->getValue(); std::map::iterator I = CompactionNodeMap.lower_bound(V); if (I != CompactionNodeMap.end() && I->first == V)