mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	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:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user