Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -796,6 +796,17 @@ ModulePassManager MPM; + // Setup PGO options. + if (CodeGenOpts.hasProfileIRInstr()) { + PB.RunProfileGen = true; + if (!CodeGenOpts.InstrProfileOutput.empty()) + PB.ProfileGenFile = CodeGenOpts.InstrProfileOutput; + else + PB.ProfileGenFile = "default_%m.profraw"; + } + if (CodeGenOpts.hasProfileIRUse()) + PB.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath; + if (!CodeGenOpts.DisableLLVMPasses) { if (CodeGenOpts.OptimizationLevel == 0) { // Build a minimal pipeline based on the semantics required by Clang,