[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.

Dehao Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 15:42:35 PST 2016


danielcdh created this revision.
danielcdh added reviewers: tejohnson, mehdi_amini, davidxl.
danielcdh added a subscriber: cfe-commits.

ThinLTO needs to pass down the sample profile file path to linker.


https://reviews.llvm.org/D27832

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2206,6 +2206,14 @@
                    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.81681.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161215/2aa8d576/attachment.bin>


More information about the cfe-commits mailing list