@@ -123,10 +123,17 @@ namespace clang {
123123extern llvm::cl::opt<bool > ClSanitizeGuardChecks;
124124}
125125
126+ // Default filename used for profile generation.
127+ static std::string getDefaultProfileGenName () {
128+ return DebugInfoCorrelate || ProfileCorrelate != InstrProfCorrelator::NONE
129+ ? " default_%m.proflite"
130+ : " default_%m.profraw" ;
131+ }
132+
126133// Path and name of file used for profile generation
127134static std::string getProfileGenName (const CodeGenOptions &CodeGenOpts) {
128135 std::string FileName = CodeGenOpts.InstrProfileOutput .empty ()
129- ? llvm::driver:: getDefaultProfileGenName ()
136+ ? getDefaultProfileGenName ()
130137 : CodeGenOpts.InstrProfileOutput ;
131138 if (CodeGenOpts.ContinuousProfileSync )
132139 FileName = " %c" + FileName;
@@ -828,45 +835,44 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
828835
829836 if (CodeGenOpts.hasProfileIRInstr ())
830837 // -fprofile-generate.
831- PGOOpt = PGOOptions (
832- getProfileGenName ( CodeGenOpts), " " , " " ,
833- CodeGenOpts. MemoryProfileUsePath , nullptr , PGOOptions::IRInstr,
834- PGOOptions::NoCSAction, llvm:: ClPGOColdFuncAttr,
835- CodeGenOpts. DebugInfoForProfiling ,
836- /* PseudoProbeForProfiling= */ false , CodeGenOpts.AtomicProfileUpdate );
838+ PGOOpt = PGOOptions (getProfileGenName (CodeGenOpts), " " , " " ,
839+ CodeGenOpts. MemoryProfileUsePath , nullptr ,
840+ PGOOptions::IRInstr, PGOOptions::NoCSAction ,
841+ ClPGOColdFuncAttr, CodeGenOpts. DebugInfoForProfiling ,
842+ /* PseudoProbeForProfiling= */ false ,
843+ CodeGenOpts.AtomicProfileUpdate );
837844 else if (CodeGenOpts.hasProfileIRUse ()) {
838845 // -fprofile-use.
839846 auto CSAction = CodeGenOpts.hasProfileCSIRUse () ? PGOOptions::CSIRUse
840847 : PGOOptions::NoCSAction;
841848 PGOOpt = PGOOptions (CodeGenOpts.ProfileInstrumentUsePath , " " ,
842849 CodeGenOpts.ProfileRemappingFile ,
843850 CodeGenOpts.MemoryProfileUsePath , VFS,
844- PGOOptions::IRUse, CSAction, llvm:: ClPGOColdFuncAttr,
851+ PGOOptions::IRUse, CSAction, ClPGOColdFuncAttr,
845852 CodeGenOpts.DebugInfoForProfiling );
846853 } else if (!CodeGenOpts.SampleProfileFile .empty ())
847854 // -fprofile-sample-use
848855 PGOOpt = PGOOptions (
849856 CodeGenOpts.SampleProfileFile , " " , CodeGenOpts.ProfileRemappingFile ,
850857 CodeGenOpts.MemoryProfileUsePath , VFS, PGOOptions::SampleUse,
851- PGOOptions::NoCSAction, llvm:: ClPGOColdFuncAttr,
858+ PGOOptions::NoCSAction, ClPGOColdFuncAttr,
852859 CodeGenOpts.DebugInfoForProfiling , CodeGenOpts.PseudoProbeForProfiling );
853860 else if (!CodeGenOpts.MemoryProfileUsePath .empty ())
854861 // -fmemory-profile-use (without any of the above options)
855- PGOOpt =
856- PGOOptions (" " , " " , " " , CodeGenOpts.MemoryProfileUsePath , VFS,
857- PGOOptions::NoAction, PGOOptions::NoCSAction,
858- llvm::ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling );
862+ PGOOpt = PGOOptions (" " , " " , " " , CodeGenOpts.MemoryProfileUsePath , VFS,
863+ PGOOptions::NoAction, PGOOptions::NoCSAction,
864+ ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling );
859865 else if (CodeGenOpts.PseudoProbeForProfiling )
860866 // -fpseudo-probe-for-profiling
861- PGOOpt = PGOOptions ( " " , " " , " " , /* MemoryProfile= */ " " , nullptr ,
862- PGOOptions::NoAction, PGOOptions::NoCSAction ,
863- llvm::ClPGOColdFuncAttr ,
864- CodeGenOpts.DebugInfoForProfiling , true );
867+ PGOOpt =
868+ PGOOptions ( " " , " " , " " , /* MemoryProfile= */ " " , nullptr ,
869+ PGOOptions::NoAction, PGOOptions::NoCSAction ,
870+ ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling , true );
865871 else if (CodeGenOpts.DebugInfoForProfiling )
866872 // -fdebug-info-for-profiling
867873 PGOOpt = PGOOptions (" " , " " , " " , /* MemoryProfile=*/ " " , nullptr ,
868874 PGOOptions::NoAction, PGOOptions::NoCSAction,
869- llvm:: ClPGOColdFuncAttr, true );
875+ ClPGOColdFuncAttr, true );
870876
871877 // Check to see if we want to generate a CS profile.
872878 if (CodeGenOpts.hasProfileCSIRInstr ()) {
0 commit comments