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