[lld] bd4757c - [ELF] --reproduce should include lto sample profile
Wenlei He via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 09:48:17 PDT 2020
Author: Christy Lee
Date: 2020-07-28T09:41:41-07:00
New Revision: bd4757cc4e40cb1b916c2c39f7bac8abc5adc294
URL: https://github.com/llvm/llvm-project/commit/bd4757cc4e40cb1b916c2c39f7bac8abc5adc294
DIFF: https://github.com/llvm/llvm-project/commit/bd4757cc4e40cb1b916c2c39f7bac8abc5adc294.diff
LOG: [ELF] --reproduce should include lto sample profile
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D84569
Added:
lld/test/ELF/reproduce-lto.s
Modified:
lld/ELF/Driver.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 30bff945f1a5..64a41ba77ba2 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -495,6 +495,9 @@ void LinkerDriver::main(ArrayRef<const char *> argsArr) {
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()));
}
diff --git a/lld/test/ELF/reproduce-lto.s b/lld/test/ELF/reproduce-lto.s
new file mode 100644
index 000000000000..e7c3ece61085
--- /dev/null
+++ b/lld/test/ELF/reproduce-lto.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+
+# RUN: rm -rf %t.dir
+# RUN: mkdir -p %t.dir/build1
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.dir/build1/foo.o
+# RUN: echo > %t.dir/build1/empty_profile.txt
+# RUN: cd %t.dir
+# RUN: ld.lld build1/foo.o -o /dev/null --reproduce repro1.tar --lto-sample-profile=%t.dir/build1/empty_profile.txt
+# RUN: tar tvf repro1.tar | FileCheck %s
+# CHECK: repro1/{{.*}}/empty_profile.txt
More information about the llvm-commits
mailing list