[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.
Dehao Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 3 16:43:54 PST 2017
danielcdh updated this revision to Diff 82975.
danielcdh added a comment.
fix function name
https://reviews.llvm.org/D27832
Files:
lib/Driver/Tools.cpp
test/Driver/gold-lto-samplepgo.c
Index: test/Driver/gold-lto-samplepgo.c
===================================================================
--- /dev/null
+++ test/Driver/gold-lto-samplepgo.c
@@ -0,0 +1,7 @@
+// RUN: touch %t.o
+//
+// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
+// RUN: -Wl,-plugin-opt=foo -O3 \
+// RUN: -fprofile-sample-use=%s \
+// RUN: | FileCheck %s
+// CHECK: -plugin-opt=sample-profile=
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2235,6 +2235,15 @@
UseSeparateSections)) {
CmdArgs.push_back("-plugin-opt=-data-sections");
}
+
+ if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) {
+ StringRef FName = A->getValue();
+ if (!llvm::sys::fs::exists(FName))
+ D.Diag(diag::err_drv_no_such_file) << FName;
+ else
+ CmdArgs.push_back(
+ Args.MakeArgString(Twine("-plugin-opt=sample-profile=") + FName));
+ }
}
/// This is a helper function for validating the optional refinement step
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27832.82975.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170104/f2b19307/attachment.bin>
More information about the cfe-commits
mailing list