Summary: ThinLTO needs to pass down the sample profile file path to linker.
Reviewers: tejohnson, davidxl, mehdi_amini
Subscribers: bruno, cfe-commits
Differential Revision: https://reviews.llvm.org/D27832
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290919
91177308-0d34-0410-b5e6-
96231b3b80d8
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
--- /dev/null
+// 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=