Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59570 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2008-11-19 00:22:02 +00:00
parent b876cc193c
commit fb5fd5a0bb

View File

@ -273,18 +273,15 @@ bool StripDebugInfo(Module &M) {
GV->setLinkage(GlobalValue::InternalLinkage);
// Delete all dbg variables.
const Type *DbgVTy = M.getTypeByName("llvm.dbg.variable.type");
const Type *DbgGVTy = M.getTypeByName("llvm.dbg.global_variable.type");
if (DbgVTy || DbgGVTy)
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
GlobalVariable *GV = dyn_cast<GlobalVariable>(I);
if (!GV) continue;
if (GV->use_empty() && llvmUsedValues.count(I) == 0
&& (!GV->hasSection()
|| strcmp(GV->getSection().c_str(), "llvm.metadata") == 0))
DeadConstants.push_back(GV);
}
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
GlobalVariable *GV = dyn_cast<GlobalVariable>(I);
if (!GV) continue;
if (GV->use_empty() && llvmUsedValues.count(I) == 0
&& (!GV->hasSection()
|| strcmp(GV->getSection().c_str(), "llvm.metadata") == 0))
DeadConstants.push_back(GV);
}
if (DeadConstants.empty())
return false;