diff options
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp index a072ba2..c38ec6b 100644 --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -2083,7 +2083,11 @@ PreservedAnalyses ControlHeightReductionPass::run( auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F); auto &DT = FAM.getResult<DominatorTreeAnalysis>(F); auto &MAMProxy = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F); - auto &PSI = *MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent()); + auto PPSI = MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent()); + // If there is no profile summary, we should not do CHR. + if (!PPSI || !PPSI->hasProfileSummary()) + return PreservedAnalyses::all(); + auto &PSI = *PPSI; auto &RI = FAM.getResult<RegionInfoAnalysis>(F); auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(F); bool Changed = CHR(F, BFI, DT, PSI, RI, ORE).run(); |