Index: ELF/LTO.h =================================================================== --- ELF/LTO.h +++ ELF/LTO.h @@ -44,11 +44,9 @@ const std::function()> &TMFactory); std::unique_ptr Combined; - llvm::IRMover Mover; std::vector> OwningData; llvm::StringSet<> InternalizedSyms; llvm::StringSet<> AsmUndefinedRefs; - std::string TheTriple; }; } } Index: ELF/LTO.cpp =================================================================== --- ELF/LTO.cpp +++ ELF/LTO.cpp @@ -144,8 +144,7 @@ } 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(S, S->body()->getName(), STV_DEFAULT, S->body()->Type); @@ -236,6 +235,7 @@ 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 @@ // Merge all the bitcode files we have seen, codegen the result // and return the resulting ObjectFile. std::vector> 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)