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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to