1 //===-- ConstantsContext.h - Constants-related Context Interals -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines various helper methods and classes used by
11 // LLVMContextImpl for creating and managing constants.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CONSTANTSCONTEXT_H
16 #define LLVM_CONSTANTSCONTEXT_H
18 #include "llvm/InlineAsm.h"
19 #include "llvm/Instructions.h"
20 #include "llvm/Operator.h"
21 #include "llvm/Support/Debug.h"
22 #include "llvm/Support/ErrorHandling.h"
23 #include "llvm/Support/raw_ostream.h"
27 template<class ValType>
28 struct ConstantTraits;
30 /// UnaryConstantExpr - This class is private to Constants.cpp, and is used
31 /// behind the scenes to implement unary constant exprs.
32 class UnaryConstantExpr : public ConstantExpr {
33 virtual void anchor();
34 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
36 // allocate space for exactly one operand
37 void *operator new(size_t s) {
38 return User::operator new(s, 1);
40 UnaryConstantExpr(unsigned Opcode, Constant *C, Type *Ty)
41 : ConstantExpr(Ty, Opcode, &Op<0>(), 1) {
44 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
47 /// BinaryConstantExpr - This class is private to Constants.cpp, and is used
48 /// behind the scenes to implement binary constant exprs.
49 class BinaryConstantExpr : public ConstantExpr {
50 virtual void anchor();
51 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
53 // allocate space for exactly two operands
54 void *operator new(size_t s) {
55 return User::operator new(s, 2);
57 BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2,
59 : ConstantExpr(C1->getType(), Opcode, &Op<0>(), 2) {
62 SubclassOptionalData = Flags;
64 /// Transparently provide more efficient getOperand methods.
65 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
68 /// SelectConstantExpr - This class is private to Constants.cpp, and is used
69 /// behind the scenes to implement select constant exprs.
70 class SelectConstantExpr : public ConstantExpr {
71 virtual void anchor();
72 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
74 // allocate space for exactly three operands
75 void *operator new(size_t s) {
76 return User::operator new(s, 3);
78 SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3)
79 : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) {
84 /// Transparently provide more efficient getOperand methods.
85 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
88 /// ExtractElementConstantExpr - This class is private to
89 /// Constants.cpp, and is used behind the scenes to implement
90 /// extractelement constant exprs.
91 class ExtractElementConstantExpr : public ConstantExpr {
92 virtual void anchor();
93 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
95 // allocate space for exactly two operands
96 void *operator new(size_t s) {
97 return User::operator new(s, 2);
99 ExtractElementConstantExpr(Constant *C1, Constant *C2)
100 : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
101 Instruction::ExtractElement, &Op<0>(), 2) {
105 /// Transparently provide more efficient getOperand methods.
106 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
109 /// InsertElementConstantExpr - This class is private to
110 /// Constants.cpp, and is used behind the scenes to implement
111 /// insertelement constant exprs.
112 class InsertElementConstantExpr : public ConstantExpr {
113 virtual void anchor();
114 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
116 // allocate space for exactly three operands
117 void *operator new(size_t s) {
118 return User::operator new(s, 3);
120 InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3)
121 : ConstantExpr(C1->getType(), Instruction::InsertElement,
127 /// Transparently provide more efficient getOperand methods.
128 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
131 /// ShuffleVectorConstantExpr - This class is private to
132 /// Constants.cpp, and is used behind the scenes to implement
133 /// shufflevector constant exprs.
134 class ShuffleVectorConstantExpr : public ConstantExpr {
135 virtual void anchor();
136 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
138 // allocate space for exactly three operands
139 void *operator new(size_t s) {
140 return User::operator new(s, 3);
142 ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3)
143 : ConstantExpr(VectorType::get(
144 cast<VectorType>(C1->getType())->getElementType(),
145 cast<VectorType>(C3->getType())->getNumElements()),
146 Instruction::ShuffleVector,
152 /// Transparently provide more efficient getOperand methods.
153 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
156 /// ExtractValueConstantExpr - This class is private to
157 /// Constants.cpp, and is used behind the scenes to implement
158 /// extractvalue constant exprs.
159 class ExtractValueConstantExpr : public ConstantExpr {
160 virtual void anchor();
161 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
163 // allocate space for exactly one operand
164 void *operator new(size_t s) {
165 return User::operator new(s, 1);
167 ExtractValueConstantExpr(Constant *Agg,
168 const SmallVector<unsigned, 4> &IdxList,
170 : ConstantExpr(DestTy, Instruction::ExtractValue, &Op<0>(), 1),
175 /// Indices - These identify which value to extract.
176 const SmallVector<unsigned, 4> Indices;
178 /// Transparently provide more efficient getOperand methods.
179 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
182 /// InsertValueConstantExpr - This class is private to
183 /// Constants.cpp, and is used behind the scenes to implement
184 /// insertvalue constant exprs.
185 class InsertValueConstantExpr : public ConstantExpr {
186 virtual void anchor();
187 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
189 // allocate space for exactly one operand
190 void *operator new(size_t s) {
191 return User::operator new(s, 2);
193 InsertValueConstantExpr(Constant *Agg, Constant *Val,
194 const SmallVector<unsigned, 4> &IdxList,
196 : ConstantExpr(DestTy, Instruction::InsertValue, &Op<0>(), 2),
202 /// Indices - These identify the position for the insertion.
203 const SmallVector<unsigned, 4> Indices;
205 /// Transparently provide more efficient getOperand methods.
206 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
210 /// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
211 /// used behind the scenes to implement getelementpr constant exprs.
212 class GetElementPtrConstantExpr : public ConstantExpr {
213 virtual void anchor();
214 GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
217 static GetElementPtrConstantExpr *Create(Constant *C,
218 const std::vector<Constant*>&IdxList,
221 GetElementPtrConstantExpr *Result =
222 new(IdxList.size() + 1) GetElementPtrConstantExpr(C, IdxList, DestTy);
223 Result->SubclassOptionalData = Flags;
226 /// Transparently provide more efficient getOperand methods.
227 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
230 // CompareConstantExpr - This class is private to Constants.cpp, and is used
231 // behind the scenes to implement ICmp and FCmp constant expressions. This is
232 // needed in order to store the predicate value for these instructions.
233 class CompareConstantExpr : public ConstantExpr {
234 virtual void anchor();
235 void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
237 // allocate space for exactly two operands
238 void *operator new(size_t s) {
239 return User::operator new(s, 2);
241 unsigned short predicate;
242 CompareConstantExpr(Type *ty, Instruction::OtherOps opc,
243 unsigned short pred, Constant* LHS, Constant* RHS)
244 : ConstantExpr(ty, opc, &Op<0>(), 2), predicate(pred) {
248 /// Transparently provide more efficient getOperand methods.
249 DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
253 struct OperandTraits<UnaryConstantExpr> :
254 public FixedNumOperandTraits<UnaryConstantExpr, 1> {
256 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryConstantExpr, Value)
259 struct OperandTraits<BinaryConstantExpr> :
260 public FixedNumOperandTraits<BinaryConstantExpr, 2> {
262 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryConstantExpr, Value)
265 struct OperandTraits<SelectConstantExpr> :
266 public FixedNumOperandTraits<SelectConstantExpr, 3> {
268 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectConstantExpr, Value)
271 struct OperandTraits<ExtractElementConstantExpr> :
272 public FixedNumOperandTraits<ExtractElementConstantExpr, 2> {
274 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementConstantExpr, Value)
277 struct OperandTraits<InsertElementConstantExpr> :
278 public FixedNumOperandTraits<InsertElementConstantExpr, 3> {
280 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementConstantExpr, Value)
283 struct OperandTraits<ShuffleVectorConstantExpr> :
284 public FixedNumOperandTraits<ShuffleVectorConstantExpr, 3> {
286 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorConstantExpr, Value)
289 struct OperandTraits<ExtractValueConstantExpr> :
290 public FixedNumOperandTraits<ExtractValueConstantExpr, 1> {
292 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractValueConstantExpr, Value)
295 struct OperandTraits<InsertValueConstantExpr> :
296 public FixedNumOperandTraits<InsertValueConstantExpr, 2> {
298 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueConstantExpr, Value)
301 struct OperandTraits<GetElementPtrConstantExpr> :
302 public VariadicOperandTraits<GetElementPtrConstantExpr, 1> {
305 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrConstantExpr, Value)
309 struct OperandTraits<CompareConstantExpr> :
310 public FixedNumOperandTraits<CompareConstantExpr, 2> {
312 DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CompareConstantExpr, Value)
314 struct ExprMapKeyType {
315 ExprMapKeyType(unsigned opc,
316 ArrayRef<Constant*> ops,
317 unsigned short flags = 0,
318 unsigned short optionalflags = 0,
319 ArrayRef<unsigned> inds = ArrayRef<unsigned>())
320 : opcode(opc), subclassoptionaldata(optionalflags), subclassdata(flags),
321 operands(ops.begin(), ops.end()), indices(inds.begin(), inds.end()) {}
323 uint8_t subclassoptionaldata;
324 uint16_t subclassdata;
325 std::vector<Constant*> operands;
326 SmallVector<unsigned, 4> indices;
327 bool operator==(const ExprMapKeyType& that) const {
328 return this->opcode == that.opcode &&
329 this->subclassdata == that.subclassdata &&
330 this->subclassoptionaldata == that.subclassoptionaldata &&
331 this->operands == that.operands &&
332 this->indices == that.indices;
334 bool operator<(const ExprMapKeyType & that) const {
335 if (this->opcode != that.opcode) return this->opcode < that.opcode;
336 if (this->operands != that.operands) return this->operands < that.operands;
337 if (this->subclassdata != that.subclassdata)
338 return this->subclassdata < that.subclassdata;
339 if (this->subclassoptionaldata != that.subclassoptionaldata)
340 return this->subclassoptionaldata < that.subclassoptionaldata;
341 if (this->indices != that.indices) return this->indices < that.indices;
345 bool operator!=(const ExprMapKeyType& that) const {
346 return !(*this == that);
350 struct InlineAsmKeyType {
351 InlineAsmKeyType(StringRef AsmString,
352 StringRef Constraints, bool hasSideEffects,
354 : asm_string(AsmString), constraints(Constraints),
355 has_side_effects(hasSideEffects), is_align_stack(isAlignStack) {}
356 std::string asm_string;
357 std::string constraints;
358 bool has_side_effects;
360 bool operator==(const InlineAsmKeyType& that) const {
361 return this->asm_string == that.asm_string &&
362 this->constraints == that.constraints &&
363 this->has_side_effects == that.has_side_effects &&
364 this->is_align_stack == that.is_align_stack;
366 bool operator<(const InlineAsmKeyType& that) const {
367 if (this->asm_string != that.asm_string)
368 return this->asm_string < that.asm_string;
369 if (this->constraints != that.constraints)
370 return this->constraints < that.constraints;
371 if (this->has_side_effects != that.has_side_effects)
372 return this->has_side_effects < that.has_side_effects;
373 if (this->is_align_stack != that.is_align_stack)
374 return this->is_align_stack < that.is_align_stack;
378 bool operator!=(const InlineAsmKeyType& that) const {
379 return !(*this == that);
383 // The number of operands for each ConstantCreator::create method is
384 // determined by the ConstantTraits template.
385 // ConstantCreator - A class that is used to create constants by
386 // ConstantUniqueMap*. This class should be partially specialized if there is
387 // something strange that needs to be done to interface to the ctor for the
390 template<typename T, typename Alloc>
391 struct ConstantTraits< std::vector<T, Alloc> > {
392 static unsigned uses(const std::vector<T, Alloc>& v) {
398 struct ConstantTraits<Constant *> {
399 static unsigned uses(Constant * const & v) {
404 template<class ConstantClass, class TypeClass, class ValType>
405 struct ConstantCreator {
406 static ConstantClass *create(TypeClass *Ty, const ValType &V) {
407 return new(ConstantTraits<ValType>::uses(V)) ConstantClass(Ty, V);
411 template<class ConstantClass>
412 struct ConstantKeyData {
413 typedef void ValType;
414 static ValType getValType(ConstantClass *C) {
415 llvm_unreachable("Unknown Constant type!");
420 struct ConstantCreator<ConstantExpr, Type, ExprMapKeyType> {
421 static ConstantExpr *create(Type *Ty, const ExprMapKeyType &V,
422 unsigned short pred = 0) {
423 if (Instruction::isCast(V.opcode))
424 return new UnaryConstantExpr(V.opcode, V.operands[0], Ty);
425 if ((V.opcode >= Instruction::BinaryOpsBegin &&
426 V.opcode < Instruction::BinaryOpsEnd))
427 return new BinaryConstantExpr(V.opcode, V.operands[0], V.operands[1],
428 V.subclassoptionaldata);
429 if (V.opcode == Instruction::Select)
430 return new SelectConstantExpr(V.operands[0], V.operands[1],
432 if (V.opcode == Instruction::ExtractElement)
433 return new ExtractElementConstantExpr(V.operands[0], V.operands[1]);
434 if (V.opcode == Instruction::InsertElement)
435 return new InsertElementConstantExpr(V.operands[0], V.operands[1],
437 if (V.opcode == Instruction::ShuffleVector)
438 return new ShuffleVectorConstantExpr(V.operands[0], V.operands[1],
440 if (V.opcode == Instruction::InsertValue)
441 return new InsertValueConstantExpr(V.operands[0], V.operands[1],
443 if (V.opcode == Instruction::ExtractValue)
444 return new ExtractValueConstantExpr(V.operands[0], V.indices, Ty);
445 if (V.opcode == Instruction::GetElementPtr) {
446 std::vector<Constant*> IdxList(V.operands.begin()+1, V.operands.end());
447 return GetElementPtrConstantExpr::Create(V.operands[0], IdxList, Ty,
448 V.subclassoptionaldata);
451 // The compare instructions are weird. We have to encode the predicate
452 // value and it is combined with the instruction opcode by multiplying
453 // the opcode by one hundred. We must decode this to get the predicate.
454 if (V.opcode == Instruction::ICmp)
455 return new CompareConstantExpr(Ty, Instruction::ICmp, V.subclassdata,
456 V.operands[0], V.operands[1]);
457 if (V.opcode == Instruction::FCmp)
458 return new CompareConstantExpr(Ty, Instruction::FCmp, V.subclassdata,
459 V.operands[0], V.operands[1]);
460 llvm_unreachable("Invalid ConstantExpr!");
466 struct ConstantKeyData<ConstantExpr> {
467 typedef ExprMapKeyType ValType;
468 static ValType getValType(ConstantExpr *CE) {
469 std::vector<Constant*> Operands;
470 Operands.reserve(CE->getNumOperands());
471 for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
472 Operands.push_back(cast<Constant>(CE->getOperand(i)));
473 return ExprMapKeyType(CE->getOpcode(), Operands,
474 CE->isCompare() ? CE->getPredicate() : 0,
475 CE->getRawSubclassOptionalData(),
477 CE->getIndices() : ArrayRef<unsigned>());
481 // ConstantAggregateZero does not take extra "value" argument...
482 template<class ValType>
483 struct ConstantCreator<ConstantAggregateZero, Type, ValType> {
484 static ConstantAggregateZero *create(Type *Ty, const ValType &V){
485 return new ConstantAggregateZero(Ty);
490 struct ConstantKeyData<ConstantVector> {
491 typedef std::vector<Constant*> ValType;
492 static ValType getValType(ConstantVector *CP) {
493 std::vector<Constant*> Elements;
494 Elements.reserve(CP->getNumOperands());
495 for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
496 Elements.push_back(CP->getOperand(i));
502 struct ConstantKeyData<ConstantAggregateZero> {
503 typedef char ValType;
504 static ValType getValType(ConstantAggregateZero *C) {
510 struct ConstantKeyData<ConstantArray> {
511 typedef std::vector<Constant*> ValType;
512 static ValType getValType(ConstantArray *CA) {
513 std::vector<Constant*> Elements;
514 Elements.reserve(CA->getNumOperands());
515 for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i)
516 Elements.push_back(cast<Constant>(CA->getOperand(i)));
522 struct ConstantKeyData<ConstantStruct> {
523 typedef std::vector<Constant*> ValType;
524 static ValType getValType(ConstantStruct *CS) {
525 std::vector<Constant*> Elements;
526 Elements.reserve(CS->getNumOperands());
527 for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i)
528 Elements.push_back(cast<Constant>(CS->getOperand(i)));
533 // ConstantPointerNull does not take extra "value" argument...
534 template<class ValType>
535 struct ConstantCreator<ConstantPointerNull, PointerType, ValType> {
536 static ConstantPointerNull *create(PointerType *Ty, const ValType &V){
537 return new ConstantPointerNull(Ty);
542 struct ConstantKeyData<ConstantPointerNull> {
543 typedef char ValType;
544 static ValType getValType(ConstantPointerNull *C) {
549 // UndefValue does not take extra "value" argument...
550 template<class ValType>
551 struct ConstantCreator<UndefValue, Type, ValType> {
552 static UndefValue *create(Type *Ty, const ValType &V) {
553 return new UndefValue(Ty);
558 struct ConstantKeyData<UndefValue> {
559 typedef char ValType;
560 static ValType getValType(UndefValue *C) {
566 struct ConstantCreator<InlineAsm, PointerType, InlineAsmKeyType> {
567 static InlineAsm *create(PointerType *Ty, const InlineAsmKeyType &Key) {
568 return new InlineAsm(Ty, Key.asm_string, Key.constraints,
569 Key.has_side_effects, Key.is_align_stack);
574 struct ConstantKeyData<InlineAsm> {
575 typedef InlineAsmKeyType ValType;
576 static ValType getValType(InlineAsm *Asm) {
577 return InlineAsmKeyType(Asm->getAsmString(), Asm->getConstraintString(),
578 Asm->hasSideEffects(), Asm->isAlignStack());
582 template<class ValType, class ValRefType, class TypeClass, class ConstantClass,
583 bool HasLargeKey = false /*true for arrays and structs*/ >
584 class ConstantUniqueMap {
586 typedef std::pair<TypeClass*, ValType> MapKey;
587 typedef std::map<MapKey, ConstantClass *> MapTy;
588 typedef std::map<ConstantClass *, typename MapTy::iterator> InverseMapTy;
590 /// Map - This is the main map from the element descriptor to the Constants.
591 /// This is the primary way we avoid creating two of the same shape
595 /// InverseMap - If "HasLargeKey" is true, this contains an inverse mapping
596 /// from the constants to their element in Map. This is important for
597 /// removal of constants from the array, which would otherwise have to scan
598 /// through the map with very large keys.
599 InverseMapTy InverseMap;
602 typename MapTy::iterator map_begin() { return Map.begin(); }
603 typename MapTy::iterator map_end() { return Map.end(); }
605 void freeConstants() {
606 for (typename MapTy::iterator I=Map.begin(), E=Map.end();
608 // Asserts that use_empty().
613 /// InsertOrGetItem - Return an iterator for the specified element.
614 /// If the element exists in the map, the returned iterator points to the
615 /// entry and Exists=true. If not, the iterator points to the newly
616 /// inserted entry and returns Exists=false. Newly inserted entries have
617 /// I->second == 0, and should be filled in.
618 typename MapTy::iterator InsertOrGetItem(std::pair<MapKey, ConstantClass *>
621 std::pair<typename MapTy::iterator, bool> IP = Map.insert(InsertVal);
627 typename MapTy::iterator FindExistingElement(ConstantClass *CP) {
629 typename InverseMapTy::iterator IMI = InverseMap.find(CP);
630 assert(IMI != InverseMap.end() && IMI->second != Map.end() &&
631 IMI->second->second == CP &&
632 "InverseMap corrupt!");
636 typename MapTy::iterator I =
637 Map.find(MapKey(static_cast<TypeClass*>(CP->getType()),
638 ConstantKeyData<ConstantClass>::getValType(CP)));
639 if (I == Map.end() || I->second != CP) {
640 // FIXME: This should not use a linear scan. If this gets to be a
641 // performance problem, someone should look at this.
642 for (I = Map.begin(); I != Map.end() && I->second != CP; ++I)
648 ConstantClass *Create(TypeClass *Ty, ValRefType V,
649 typename MapTy::iterator I) {
650 ConstantClass* Result =
651 ConstantCreator<ConstantClass,TypeClass,ValType>::create(Ty, V);
653 assert(Result->getType() == Ty && "Type specified is not correct!");
654 I = Map.insert(I, std::make_pair(MapKey(Ty, V), Result));
656 if (HasLargeKey) // Remember the reverse mapping if needed.
657 InverseMap.insert(std::make_pair(Result, I));
663 /// getOrCreate - Return the specified constant from the map, creating it if
665 ConstantClass *getOrCreate(TypeClass *Ty, ValRefType V) {
666 MapKey Lookup(Ty, V);
667 ConstantClass* Result = 0;
669 typename MapTy::iterator I = Map.find(Lookup);
675 // If no preexisting value, create one now...
676 Result = Create(Ty, V, I);
682 void remove(ConstantClass *CP) {
683 typename MapTy::iterator I = FindExistingElement(CP);
684 assert(I != Map.end() && "Constant not found in constant table!");
685 assert(I->second == CP && "Didn't find correct element?");
687 if (HasLargeKey) // Remember the reverse mapping if needed.
688 InverseMap.erase(CP);
693 /// MoveConstantToNewSlot - If we are about to change C to be the element
694 /// specified by I, update our internal data structures to reflect this
696 void MoveConstantToNewSlot(ConstantClass *C, typename MapTy::iterator I) {
697 // First, remove the old location of the specified constant in the map.
698 typename MapTy::iterator OldI = FindExistingElement(C);
699 assert(OldI != Map.end() && "Constant not found in constant table!");
700 assert(OldI->second == C && "Didn't find correct element?");
702 // Remove the old entry from the map.
705 // Update the inverse map so that we know that this constant is now
706 // located at descriptor I.
708 assert(I->second == C && "Bad inversemap entry!");
714 DEBUG(dbgs() << "Constant.cpp: ConstantUniqueMap\n");