summaryrefslogtreecommitdiff
path: root/lib/Analysis/IPA/FindUsedTypes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-23 19:30:30 +0000
committerChris Lattner <sabre@nondot.org>2003-10-23 19:30:30 +0000
commit472a7ef1cb9cca42cc26baea1acc4c80b5836a58 (patch)
tree2838bd2981672f7f25748602bdf877ec78225035 /lib/Analysis/IPA/FindUsedTypes.cpp
parent10be6a6c73ef50d93402d84f251c0344426c5132 (diff)
downloadllvm-472a7ef1cb9cca42cc26baea1acc4c80b5836a58.tar.gz
llvm-472a7ef1cb9cca42cc26baea1acc4c80b5836a58.tar.bz2
llvm-472a7ef1cb9cca42cc26baea1acc4c80b5836a58.tar.xz
Fix bug: CBackend/2003-10-23-UnusedType.ll and hopefully 252.eon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/FindUsedTypes.cpp')
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index ad548d0f9a..91b599017e 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -41,12 +41,22 @@ void FindUsedTypes::IncorporateType(const Type *Ty) {
IncorporateType(*I);
}
+void FindUsedTypes::IncorporateSymbolTable(const SymbolTable &ST) {
+ SymbolTable::const_iterator TI = ST.find(Type::TypeTy);
+ if (TI == ST.end()) return; // No named types
+
+ for (SymbolTable::type_const_iterator I = TI->second.begin(),
+ E = TI->second.end(); I != E; ++I)
+ IncorporateType(cast<Type>(I->second));
+}
// run - This incorporates all types used by the specified module
//
bool FindUsedTypes::run(Module &m) {
UsedTypes.clear(); // reset if run multiple times...
+ IncorporateSymbolTable(m.getSymbolTable());
+
// Loop over global variables, incorporating their types
for (Module::const_giterator I = m.gbegin(), E = m.gend(); I != E; ++I)
IncorporateType(I->getType());
@@ -54,6 +64,7 @@ bool FindUsedTypes::run(Module &m) {
for (Module::iterator MI = m.begin(), ME = m.end(); MI != ME; ++MI) {
IncorporateType(MI->getType());
const Function &F = *MI;
+ IncorporateSymbolTable(F.getSymbolTable());
// Loop over all of the instructions in the function, adding their return
// type as well as the types of their operands.