@@ -485,11 +485,11 @@ class SampleProfileLoader final : public SampleProfileLoaderBaseImpl<Function> {
485
485
UseFlattenedProfile(UseFlattenedProfile) {}
486
486
487
487
bool doInitialization (Module &M, FunctionAnalysisManager *FAM = nullptr );
488
- bool runOnModule (Module &M, ModuleAnalysisManager * AM,
488
+ bool runOnModule (Module &M, ModuleAnalysisManager & AM,
489
489
ProfileSummaryInfo *_PSI);
490
490
491
491
protected:
492
- bool runOnFunction (Function &F, ModuleAnalysisManager * AM);
492
+ bool runOnFunction (Function &F, ModuleAnalysisManager & AM);
493
493
bool emitAnnotations (Function &F);
494
494
ErrorOr<uint64_t > getInstWeight (const Instruction &I) override ;
495
495
const FunctionSamples *findCalleeFunctionSamples (const CallBase &I) const ;
@@ -2160,7 +2160,7 @@ void SampleProfileLoader::removePseudoProbeInstsDiscriminator(Module &M) {
2160
2160
}
2161
2161
}
2162
2162
2163
- bool SampleProfileLoader::runOnModule (Module &M, ModuleAnalysisManager * AM,
2163
+ bool SampleProfileLoader::runOnModule (Module &M, ModuleAnalysisManager & AM,
2164
2164
ProfileSummaryInfo *_PSI) {
2165
2165
GUIDToFuncNameMapper Mapper (M, *Reader, GUIDToFuncNameMap);
2166
2166
@@ -2238,7 +2238,8 @@ bool SampleProfileLoader::runOnModule(Module &M, ModuleAnalysisManager *AM,
2238
2238
return retval;
2239
2239
}
2240
2240
2241
- bool SampleProfileLoader::runOnFunction (Function &F, ModuleAnalysisManager *AM) {
2241
+ bool SampleProfileLoader::runOnFunction (Function &F,
2242
+ ModuleAnalysisManager &AM) {
2242
2243
LLVM_DEBUG (dbgs () << " \n\n Processing Function " << F.getName () << " \n " );
2243
2244
DILocation2SampleMap.clear ();
2244
2245
// By default the entry count is initialized to -1, which will be treated
@@ -2290,15 +2291,9 @@ bool SampleProfileLoader::runOnFunction(Function &F, ModuleAnalysisManager *AM)
2290
2291
if (!F.getEntryCount ())
2291
2292
F.setEntryCount (ProfileCount (initialEntryCount, Function::PCT_Real));
2292
2293
std::unique_ptr<OptimizationRemarkEmitter> OwnedORE;
2293
- if (AM) {
2294
- auto &FAM =
2295
- AM->getResult <FunctionAnalysisManagerModuleProxy>(*F.getParent ())
2296
- .getManager ();
2297
- ORE = &FAM.getResult <OptimizationRemarkEmitterAnalysis>(F);
2298
- } else {
2299
- OwnedORE = std::make_unique<OptimizationRemarkEmitter>(&F);
2300
- ORE = OwnedORE.get ();
2301
- }
2294
+ auto &FAM = AM.getResult <FunctionAnalysisManagerModuleProxy>(*F.getParent ())
2295
+ .getManager ();
2296
+ ORE = &FAM.getResult <OptimizationRemarkEmitterAnalysis>(F);
2302
2297
2303
2298
if (FunctionSamples::ProfileIsCS)
2304
2299
Samples = ContextTracker->getBaseSamplesFor (F);
@@ -2363,7 +2358,7 @@ PreservedAnalyses SampleProfileLoaderPass::run(Module &M,
2363
2358
return PreservedAnalyses::all ();
2364
2359
2365
2360
ProfileSummaryInfo *PSI = &AM.getResult <ProfileSummaryAnalysis>(M);
2366
- if (!SampleLoader.runOnModule (M, & AM, PSI))
2361
+ if (!SampleLoader.runOnModule (M, AM, PSI))
2367
2362
return PreservedAnalyses::all ();
2368
2363
2369
2364
return PreservedAnalyses::none ();
0 commit comments