llvm.org GIT mirror llvm / 33f1d5b
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 Chris Lattner 12 years ago
2 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
8383 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
8484 for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
8585 OI != E; ++OI)
86 EnumerateType((*OI)->getType());
86 EnumerateOperandType(*OI);
8787 EnumerateType(I->getType());
8888 }
8989 }
225225 EnumerateParamAttrs(FTy->getParamAttrs());
226226 }
227227
228 // Enumerate the types for the specified value. If the value is a constant,
229 // walk through it, enumerating the types of the constant.
230 void ValueEnumerator::EnumerateOperandType(const Value *V) {
231 EnumerateType(V->getType());
232 if (const Constant *C = dyn_cast(V)) {
233 // If this constant is already enumerated, ignore it, we know its type must
234 // be enumerated.
235 if (ValueMap.count(V)) return;
236
237 // This constant may have operands, make sure to enumerate the types in
238 // them.
239 for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
240 EnumerateOperandType(C->getOperand(i));
241 }
242 }
243
228244 void ValueEnumerator::EnumerateParamAttrs(const ParamAttrsList *PAL) {
229245 if (PAL == 0) return; // null is always 0.
230246 // Do a lookup.
113113
114114 void EnumerateValue(const Value *V);
115115 void EnumerateType(const Type *T);
116 void EnumerateOperandType(const Value *V);
116117 void EnumerateParamAttrs(const ParamAttrsList *PAL);
117118
118119 void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);