@@ -762,31 +762,37 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
762762 PGOOpt = PGOOptions (
763763 CodeGenOpts.InstrProfileOutput .empty () ? getDefaultProfileGenName ()
764764 : CodeGenOpts.InstrProfileOutput ,
765- " " , " " , nullptr , PGOOptions::IRInstr , PGOOptions::NoCSAction ,
766- CodeGenOpts.DebugInfoForProfiling );
765+ " " , " " , CodeGenOpts. MemoryProfileUsePath , nullptr , PGOOptions::IRInstr ,
766+ PGOOptions::NoCSAction, CodeGenOpts.DebugInfoForProfiling );
767767 else if (CodeGenOpts.hasProfileIRUse ()) {
768768 // -fprofile-use.
769769 auto CSAction = CodeGenOpts.hasProfileCSIRUse () ? PGOOptions::CSIRUse
770770 : PGOOptions::NoCSAction;
771- PGOOpt =
772- PGOOptions ( CodeGenOpts.ProfileInstrumentUsePath , " " ,
773- CodeGenOpts.ProfileRemappingFile , VFS, PGOOptions::IRUse ,
774- CSAction, CodeGenOpts.DebugInfoForProfiling );
771+ PGOOpt = PGOOptions (
772+ CodeGenOpts.ProfileInstrumentUsePath , " " ,
773+ CodeGenOpts.ProfileRemappingFile , CodeGenOpts. MemoryProfileUsePath , VFS ,
774+ PGOOptions::IRUse, CSAction, CodeGenOpts.DebugInfoForProfiling );
775775 } else if (!CodeGenOpts.SampleProfileFile .empty ())
776776 // -fprofile-sample-use
777777 PGOOpt = PGOOptions (
778778 CodeGenOpts.SampleProfileFile , " " , CodeGenOpts.ProfileRemappingFile ,
779- VFS, PGOOptions::SampleUse, PGOOptions::NoCSAction,
780- CodeGenOpts.DebugInfoForProfiling , CodeGenOpts.PseudoProbeForProfiling );
779+ CodeGenOpts.MemoryProfileUsePath , VFS, PGOOptions::SampleUse,
780+ PGOOptions::NoCSAction, CodeGenOpts.DebugInfoForProfiling ,
781+ CodeGenOpts.PseudoProbeForProfiling );
782+ else if (!CodeGenOpts.MemoryProfileUsePath .empty ())
783+ // -fmemory-profile-use (without any of the above options)
784+ PGOOpt = PGOOptions (" " , " " , " " , CodeGenOpts.MemoryProfileUsePath , VFS,
785+ PGOOptions::NoAction, PGOOptions::NoCSAction,
786+ CodeGenOpts.DebugInfoForProfiling );
781787 else if (CodeGenOpts.PseudoProbeForProfiling )
782788 // -fpseudo-probe-for-profiling
783- PGOOpt = PGOOptions (" " , " " , " " , nullptr , PGOOptions::NoAction ,
784- PGOOptions::NoCSAction,
789+ PGOOpt = PGOOptions (" " , " " , " " , /* MemoryProfile= */ " " , nullptr ,
790+ PGOOptions::NoAction, PGOOptions:: NoCSAction,
785791 CodeGenOpts.DebugInfoForProfiling , true );
786792 else if (CodeGenOpts.DebugInfoForProfiling )
787793 // -fdebug-info-for-profiling
788- PGOOpt = PGOOptions (" " , " " , " " , nullptr , PGOOptions::NoAction ,
789- PGOOptions::NoCSAction, true );
794+ PGOOpt = PGOOptions (" " , " " , " " , /* MemoryProfile= */ " " , nullptr ,
795+ PGOOptions::NoAction, PGOOptions:: NoCSAction, true );
790796
791797 // Check to see if we want to generate a CS profile.
792798 if (CodeGenOpts.hasProfileCSIRInstr ()) {
@@ -808,8 +814,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
808814 CodeGenOpts.InstrProfileOutput .empty ()
809815 ? getDefaultProfileGenName ()
810816 : CodeGenOpts.InstrProfileOutput ,
811- " " , nullptr , PGOOptions::NoAction , PGOOptions::CSIRInstr ,
812- CodeGenOpts.DebugInfoForProfiling );
817+ " " , /* MemoryProfile= */ " " , nullptr , PGOOptions::NoAction ,
818+ PGOOptions::CSIRInstr, CodeGenOpts.DebugInfoForProfiling );
813819 }
814820 if (TM)
815821 TM->setPGOOption (PGOOpt);
0 commit comments