Blame SOURCES/0001-Disable-threading-in-LTO.patch

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