[llvm-commits] CVS: llvm/lib/Analysis/IPA/FindUsedTypes.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 23 14:31:01 PDT 2003


Changes in directory llvm/lib/Analysis/IPA:

FindUsedTypes.cpp updated: 1.20 -> 1.21

---
Log message:

Fix bug: CBackend/2003-10-23-UnusedType.ll and hopefully 252.eon


---
Diffs of the changes:  (+11 -0)

Index: llvm/lib/Analysis/IPA/FindUsedTypes.cpp
diff -u llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.20 llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.21
--- llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.20	Mon Oct 20 14:43:08 2003
+++ llvm/lib/Analysis/IPA/FindUsedTypes.cpp	Thu Oct 23 14:30:30 2003
@@ -41,12 +41,22 @@
     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 @@
   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.





More information about the llvm-commits mailing list