From ba12c23ca7684c94dd538577827dce8b3c1cf451 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 2 Nov 2003 01:28:41 +0000 Subject: [PATCH] Including the symbol table in the FindUsedTypes analysis was the WRONG way to fix test/Regression/CBackend/2003-10-23-UnusedType.ll. This completely neutered the deadtypeelim pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9646 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/FindUsedTypes.h | 5 ----- lib/Analysis/IPA/FindUsedTypes.cpp | 16 +++------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 740e0517265..a246084dbb4 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -16,7 +16,6 @@ #include "llvm/Pass.h" #include -class SymbolTable; class Type; class FindUsedTypes : public Pass { @@ -43,10 +42,6 @@ private: /// void IncorporateValue(const Value *V); - /// IncorporateSymbolTable - Include any named types. - /// - void IncorporateSymbolTable(const SymbolTable &ST); - public: /// run - This incorporates all types used by the specified module bool run(Module &M); diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp index db5d64c0a0e..80bf378b5eb 100644 --- a/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/lib/Analysis/IPA/FindUsedTypes.cpp @@ -7,7 +7,9 @@ // //===----------------------------------------------------------------------===// // -// This pass is used to seek out all of the types in use by the program. +// This pass is used to seek out all of the types in use by the program. Note +// that this analysis explicitly does not include types only used by the symbol +// table. // //===----------------------------------------------------------------------===// @@ -42,15 +44,6 @@ 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(I->second)); -} - void FindUsedTypes::IncorporateValue(const Value *V) { IncorporateType(V->getType()); @@ -68,8 +61,6 @@ void FindUsedTypes::IncorporateValue(const Value *V) { 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()); @@ -80,7 +71,6 @@ 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.