[PATCH] D84569: [ELF] --reproduce should include lto sample profile

Christy Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 17:19:54 PDT 2020


christylee created this revision.
Herald added subscribers: llvm-commits, dexonsmith, MaskRay, arichardson, inglorion, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84569

Files:
  lld/ELF/Driver.cpp
  lld/test/ELF/reproduce.s


Index: lld/test/ELF/reproduce.s
===================================================================
--- lld/test/ELF/reproduce.s
+++ lld/test/ELF/reproduce.s
@@ -3,10 +3,13 @@
 # RUN: rm -rf %t.dir
 # RUN: mkdir -p %t.dir/build1
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/build1/foo.o
+# RUN: echo "# empty lto sample profile" > %t.dir/build1/empty_profile.txt
 # RUN: cd %t.dir
-# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro1.tar
+# RUN: ld.lld --hash-style=gnu build1/foo.o -o bar -shared --as-needed --reproduce repro1.tar --lto-sample-profile=%t.dir/build1/empty_profile.txt
 # RUN: tar xOf repro1.tar repro1/%:t.dir/build1/foo.o > build1-foo.o
 # RUN: cmp build1/foo.o build1-foo.o
+# RUN: tar tvf repro1.tar | FileCheck %s --check-prefix=LTO_SAMPLE_PROFILE
+# LTO_SAMPLE_PROFILE: repro1/{{.*}}/empty_profile.txt
 
 # RUN: tar xf repro1.tar repro1/response.txt repro1/version.txt
 # RUN: FileCheck %s --check-prefix=RSP1 < repro1/response.txt
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -492,9 +492,13 @@
     Expected<std::unique_ptr<TarWriter>> errOrWriter =
         TarWriter::create(path, path::stem(path));
     if (errOrWriter) {
+      printf("errOrWriter\n");
       tar = std::move(*errOrWriter);
       tar->append("response.txt", createResponseFile(args));
       tar->append("version.txt", getLLDVersion() + "\n");
+      StringRef ltoSampleProfile = args.getLastArgValue(OPT_lto_sample_profile);
+      if (!ltoSampleProfile.empty())
+        readFile(ltoSampleProfile);
     } else {
       error("--reproduce: " + toString(errOrWriter.takeError()));
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84569.280631.patch
Type: text/x-patch
Size: 1749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200725/2f9ded09/attachment.bin>


More information about the llvm-commits mailing list