@@ -762,31 +762,37 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
762
762
PGOOpt = PGOOptions (
763
763
CodeGenOpts.InstrProfileOutput .empty () ? getDefaultProfileGenName ()
764
764
: CodeGenOpts.InstrProfileOutput ,
765
- " " , " " , nullptr , PGOOptions::IRInstr , PGOOptions::NoCSAction ,
766
- CodeGenOpts.DebugInfoForProfiling );
765
+ " " , " " , CodeGenOpts. MemoryProfileUsePath , nullptr , PGOOptions::IRInstr ,
766
+ PGOOptions::NoCSAction, CodeGenOpts.DebugInfoForProfiling );
767
767
else if (CodeGenOpts.hasProfileIRUse ()) {
768
768
// -fprofile-use.
769
769
auto CSAction = CodeGenOpts.hasProfileCSIRUse () ? PGOOptions::CSIRUse
770
770
: 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 );
775
775
} else if (!CodeGenOpts.SampleProfileFile .empty ())
776
776
// -fprofile-sample-use
777
777
PGOOpt = PGOOptions (
778
778
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 );
781
787
else if (CodeGenOpts.PseudoProbeForProfiling )
782
788
// -fpseudo-probe-for-profiling
783
- PGOOpt = PGOOptions (" " , " " , " " , nullptr , PGOOptions::NoAction ,
784
- PGOOptions::NoCSAction,
789
+ PGOOpt = PGOOptions (" " , " " , " " , /* MemoryProfile= */ " " , nullptr ,
790
+ PGOOptions::NoAction, PGOOptions:: NoCSAction,
785
791
CodeGenOpts.DebugInfoForProfiling , true );
786
792
else if (CodeGenOpts.DebugInfoForProfiling )
787
793
// -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 );
790
796
791
797
// Check to see if we want to generate a CS profile.
792
798
if (CodeGenOpts.hasProfileCSIRInstr ()) {
@@ -808,8 +814,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
808
814
CodeGenOpts.InstrProfileOutput .empty ()
809
815
? getDefaultProfileGenName ()
810
816
: CodeGenOpts.InstrProfileOutput ,
811
- " " , nullptr , PGOOptions::NoAction , PGOOptions::CSIRInstr ,
812
- CodeGenOpts.DebugInfoForProfiling );
817
+ " " , /* MemoryProfile= */ " " , nullptr , PGOOptions::NoAction ,
818
+ PGOOptions::CSIRInstr, CodeGenOpts.DebugInfoForProfiling );
813
819
}
814
820
if (TM)
815
821
TM->setPGOOption (PGOOpt);
0 commit comments