diff options
author | Rong Xu <xur@google.com> | 2023-02-27 09:51:28 -0800 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2023-02-27 11:47:54 -0800 |
commit | 666731660c733896b83de5eec49e2cd469aef02c (patch) | |
tree | 8d310c3257fd586c9e3652d350d7da0f470d6354 /llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp | |
parent | 2f3c748c45ff7f9022ffa88d5a06a856a1b15ace (diff) | |
download | llvm-666731660c733896b83de5eec49e2cd469aef02c.zip llvm-666731660c733896b83de5eec49e2cd469aef02c.tar.gz llvm-666731660c733896b83de5eec49e2cd469aef02c.tar.bz2 |
[Pass][CHR] Move ControlHeightReduction to module optimization pipeline
This is a modified version of commit b374423304a8 by
Arthur (https://reviews.llvm.org/D143424).
Here we invoke to the pass independent of PGOOPT. We now check if the
profile is available through the program summary. This ensures CHR is
called in distributed ThinLTO BE compilation (where PGOOPT might not
be created).
Differential Revision: https://reviews.llvm.org/D144769
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(); |