Blob Blame History Raw
diff -ru llvm-8.0.0.src/lib/LTO/LTOBackend.cpp llvm-8.0.0.src.new/lib/LTO/LTOBackend.cpp
--- llvm-8.0.0.src/lib/LTO/LTOBackend.cpp	2018-11-08 20:10:07.000000000 +0000
+++ llvm-8.0.0.src.new/lib/LTO/LTOBackend.cpp	2019-05-13 18:29:18.904405949 +0000
@@ -336,49 +336,7 @@
 void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream,
                   unsigned ParallelCodeGenParallelismLevel,
                   std::unique_ptr<Module> Mod) {
-  ThreadPool CodegenThreadPool(ParallelCodeGenParallelismLevel);
-  unsigned ThreadCount = 0;
-  const Target *T = &TM->getTarget();
-
-  SplitModule(
-      std::move(Mod), ParallelCodeGenParallelismLevel,
-      [&](std::unique_ptr<Module> MPart) {
-        // We want to clone the module in a new context to multi-thread the
-        // codegen. We do it by serializing partition modules to bitcode
-        // (while still on the main thread, in order to avoid data races) and
-        // spinning up new threads which deserialize the partitions into
-        // separate contexts.
-        // FIXME: Provide a more direct way to do this in LLVM.
-        SmallString<0> BC;
-        raw_svector_ostream BCOS(BC);
-        WriteBitcodeToFile(*MPart, BCOS);
-
-        // Enqueue the task
-        CodegenThreadPool.async(
-            [&](const SmallString<0> &BC, unsigned ThreadId) {
-              LTOLLVMContext Ctx(C);
-              Expected<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
-                  MemoryBufferRef(StringRef(BC.data(), BC.size()), "ld-temp.o"),
-                  Ctx);
-              if (!MOrErr)
-                report_fatal_error("Failed to read bitcode");
-              std::unique_ptr<Module> MPartInCtx = std::move(MOrErr.get());
-
-              std::unique_ptr<TargetMachine> TM =
-                  createTargetMachine(C, T, *MPartInCtx);
-
-              codegen(C, TM.get(), AddStream, ThreadId, *MPartInCtx);
-            },
-            // Pass BC using std::move to ensure that it get moved rather than
-            // copied into the thread's context.
-            std::move(BC), ThreadCount++);
-      },
-      false);
-
-  // Because the inner lambda (which runs in a worker thread) captures our local
-  // variables, we need to wait for the worker threads to terminate before we
-  // can leave the function scope.
-  CodegenThreadPool.wait();
+  codegen(C, TM, AddStream, 0, *Mod);
 }
 
 Expected<const Target *> initAndLookupTarget(Config &C, Module &Mod) {
diff -ru llvm-8.0.0.src/test/tools/gold/X86/emit-asm.ll llvm-8.0.0.src.new/test/tools/gold/X86/emit-asm.ll
--- llvm-8.0.0.src/test/tools/gold/X86/emit-asm.ll	2019-01-02 23:48:00.000000000 +0000
+++ llvm-8.0.0.src.new/test/tools/gold/X86/emit-asm.ll	2019-05-14 07:23:17.826288558 +0000
@@ -7,8 +7,7 @@
 
 ; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
 ; RUN:    -m elf_x86_64 --plugin-opt=emit-asm --plugin-opt=lto-partitions=2\
-; RUN:    -shared %t.o -o %t2.s
-; RUN: cat %t2.s %t2.s1 > %t3.s
+; RUN:    -shared %t.o -o %t3.s
 ; RUN: FileCheck --input-file %t3.s %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff -ru llvm-8.0.0.src/test/tools/gold/X86/parallel.ll llvm-8.0.0.src.new/test/tools/gold/X86/parallel.ll
--- llvm-8.0.0.src/test/tools/gold/X86/parallel.ll	2017-12-14 15:59:05.000000000 +0000
+++ llvm-8.0.0.src.new/test/tools/gold/X86/parallel.ll	2019-05-14 08:01:45.147862168 +0000
@@ -1,10 +1,6 @@
 ; RUN: llvm-as -o %t.bc %s
 ; RUN: rm -f %t.0.5.precodegen.bc %t.1.5.precodegen.bc %t.o %t.o1
 ; RUN: env LD_PRELOAD=%llvmshlibdir/LLVMgold%shlibext %gold -plugin %llvmshlibdir/LLVMgold%shlibext -u foo -u bar -plugin-opt lto-partitions=2 -plugin-opt save-temps -m elf_x86_64 -o %t %t.bc
-; RUN: llvm-dis %t.0.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC0 %s
-; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck --check-prefix=CHECK-BC1 %s
-; RUN: llvm-nm %t.o | FileCheck --check-prefix=CHECK0 %s
-; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"