8000 Merged revision 1.21. · inside-compiler/llvm-project@faa1d1f · GitHub
[go: up one dir, main page]

Skip to content

Commit faa1d1f

Browse files
author
John Criswell
committed
Merged revision 1.21.
llvm-svn: 9462
1 parent 0d6d28b commit faa1d1f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/lib/Analysis/IPA/FindUsedTypes.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,30 @@ void FindUsedTypes::IncorporateType(const Type *Ty) {
4141
IncorporateType(*I);
4242
}
4343

44+
void FindUsedTypes::IncorporateSymbolTable(const SymbolTable &ST) {
45+
SymbolTable::const_iterator TI = ST.find(Type::TypeTy);
46+
if (TI == ST.end()) return; // No named types
47+
48+
for (SymbolTable::type_const_iterator I = TI->second.begin(),
49+
E = TI->second.end(); I != E; ++I)
50+
IncorporateType(cast<Type>(I->second));
51+
}
4452

4553
// run - This incorporates all types used by the specified module
4654
//
4755
bool FindUsedTypes::run(Module &m) {
4856
UsedTypes.clear(); // reset if run multiple times...
4957

58+
IncorporateSymbolTable(m.getSymbolTable());
59+
5060
// Loop over global variables, incorporating their types
5161
for (Module::const_giterator I = m.gbegin(), E = m.gend(); I != E; ++I)
5262
IncorporateType(I->getType());
5363

5464
for (Module::iterator MI = m.begin(), ME = m.end(); MI != ME; ++MI) {
5565
IncorporateType(MI->getType());
5666
const Function &F = *MI;
67+
IncorporateSymbolTable(F.getSymbolTable());
5768

5869
// Loop over all of the instructions in the function, adding their return
5970
// type as well as the types of their operands.

0 commit comments

Comments
 (0)
0