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