[lld] r275526 - ELF: Remove member variables that are used only in one function.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 20:06:42 PDT 2016


Author: ruiu
Date: Thu Jul 14 22:06:42 2016
New Revision: 275526

URL: http://llvm.org/viewvc/llvm-project?rev=275526&view=rev
Log:
ELF: Remove member variables that are used only in one function.

Differential Revision: https://reviews.llvm.org/D22396

Modified:
    lld/trunk/ELF/LTO.cpp
    lld/trunk/ELF/LTO.h

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=275526&r1=275525&r2=275526&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Thu Jul 14 22:06:42 2016
@@ -144,8 +144,7 @@ static bool shouldInternalize(const Smal
 }
 
 BitcodeCompiler::BitcodeCompiler()
-    : Combined(new llvm::Module("ld-temp.o", Driver->Context)),
-      Mover(*Combined) {}
+    : Combined(new llvm::Module("ld-temp.o", Driver->Context)) {}
 
 static void undefine(Symbol *S) {
   replaceBody<Undefined>(S, S->body()->getName(), STV_DEFAULT, S->body()->Type);
@@ -236,6 +235,7 @@ void BitcodeCompiler::add(BitcodeFile &F
     Keep.push_back(GV);
   }
 
+  IRMover Mover(*Combined);
   if (Error E = Mover.move(Obj->takeModule(), Keep,
                            [](GlobalValue &, IRMover::ValueAdder) {})) {
     handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EIB) {
@@ -286,13 +286,13 @@ std::vector<std::unique_ptr<InputFile>>
 // Merge all the bitcode files we have seen, codegen the result
 // and return the resulting ObjectFile.
 std::vector<std::unique_ptr<InputFile>> BitcodeCompiler::compile() {
-  TheTriple = Combined->getTargetTriple();
   for (const auto &Name : InternalizedSyms) {
     GlobalValue *GV = Combined->getNamedValue(Name.first());
     assert(GV);
     internalize(*GV);
   }
 
+  std::string TheTriple = Combined->getTargetTriple();
   std::string Msg;
   const Target *T = TargetRegistry::lookupTarget(TheTriple, Msg);
   if (!T)

Modified: lld/trunk/ELF/LTO.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.h?rev=275526&r1=275525&r2=275526&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.h (original)
+++ lld/trunk/ELF/LTO.h Thu Jul 14 22:06:42 2016
@@ -44,11 +44,9 @@ private:
       const std::function<std::unique_ptr<llvm::TargetMachine>()> &TMFactory);
 
   std::unique_ptr<llvm::Module> Combined;
-  llvm::IRMover Mover;
   std::vector<SmallString<0>> OwningData;
   llvm::StringSet<> InternalizedSyms;
   llvm::StringSet<> AsmUndefinedRefs;
-  std::string TheTriple;
 };
 }
 }




More information about the llvm-commits mailing list