Fix a nasty problem where we would miss enumeration of some types. This fixes

issues with CE_CAST etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36864 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-05-06 08:35:19 +00:00
parent b55a5803b2
commit 33f1d5b328
2 changed files with 18 additions and 1 deletions

View File

@ -84,7 +84,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
OI != E; ++OI)
EnumerateType((*OI)->getType());
EnumerateOperandType(*OI);
EnumerateType(I->getType());
}
}
@ -226,6 +226,22 @@ void ValueEnumerator::EnumerateType(const Type *Ty) {
EnumerateParamAttrs(FTy->getParamAttrs());
}
// Enumerate the types for the specified value. If the value is a constant,
// walk through it, enumerating the types of the constant.
void ValueEnumerator::EnumerateOperandType(const Value *V) {
EnumerateType(V->getType());
if (const Constant *C = dyn_cast<Constant>(V)) {
// If this constant is already enumerated, ignore it, we know its type must
// be enumerated.
if (ValueMap.count(V)) return;
// This constant may have operands, make sure to enumerate the types in
// them.
for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
EnumerateOperandType(C->getOperand(i));
}
}
void ValueEnumerator::EnumerateParamAttrs(const ParamAttrsList *PAL) {
if (PAL == 0) return; // null is always 0.
// Do a lookup.

View File

@ -114,6 +114,7 @@ private:
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
void EnumerateOperandType(const Value *V);
void EnumerateParamAttrs(const ParamAttrsList *PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);