Add -fprofile-sample-use to Clang's driver.
This adds a new option -fprofile-sample-use=filename to Clang. It tells the driver to schedule the SampleProfileLoader pass and passes on the name of the profile file to use. llvm-svn: 194567
This commit is contained in:
@@ -154,6 +154,14 @@ static void addObjCARCOptPass(const PassManagerBuilder &Builder, PassManagerBase
|
||||
PM.add(createObjCARCOptPass());
|
||||
}
|
||||
|
||||
static void addSampleProfileLoaderPass(const PassManagerBuilder &Builder,
|
||||
PassManagerBase &PM) {
|
||||
const PassManagerBuilderWrapper &BuilderWrapper =
|
||||
static_cast<const PassManagerBuilderWrapper &>(Builder);
|
||||
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
|
||||
PM.add(createSampleProfileLoaderPass(CGOpts.SampleProfileFile));
|
||||
}
|
||||
|
||||
static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
|
||||
PassManagerBase &PM) {
|
||||
PM.add(createBoundsCheckingPass());
|
||||
@@ -235,6 +243,10 @@ void EmitAssemblyHelper::CreatePasses(TargetMachine *TM) {
|
||||
PMBuilder.DisableUnitAtATime = !CodeGenOpts.UnitAtATime;
|
||||
PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops;
|
||||
|
||||
if (!CodeGenOpts.SampleProfileFile.empty())
|
||||
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
|
||||
addSampleProfileLoaderPass);
|
||||
|
||||
// In ObjC ARC mode, add the main ARC optimization passes.
|
||||
if (LangOpts.ObjCAutoRefCount) {
|
||||
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
|
||||
|
||||
Reference in New Issue
Block a user