[llvm] da3623d - [JT] Always create BPI/BFI when running in legacy PM

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 01:18:08 PST 2023


Author: Benjamin Kramer
Date: 2023-02-17T10:13:20+01:00
New Revision: da3623de2411dd931913eb510e94fe846c929c24

URL: https://github.com/llvm/llvm-project/commit/da3623de2411dd931913eb510e94fe846c929c24
DIFF: https://github.com/llvm/llvm-project/commit/da3623de2411dd931913eb510e94fe846c929c24.diff

LOG: [JT] Always create BPI/BFI when running in legacy PM

This is wasteful, but only affects the legacy pass manager. Otherwise
a1b78fb929fccf96acaa0212cf68fee82298e747 would crash JT when running
with that PM. There are still a few users of the legacy PM out there
that are reluctant to migrate, numba in this case.

No test as we don't test legacy PM anymore.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/JumpThreading.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index ae9868ecdf7a5..eac41f05ca14f 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -315,13 +315,10 @@ bool JumpThreading::runOnFunction(Function &F) {
   auto DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
   auto LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI();
   auto AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
-  std::unique_ptr<BlockFrequencyInfo> BFI;
-  std::unique_ptr<BranchProbabilityInfo> BPI;
-  if (F.hasProfileData()) {
-    LoopInfo LI{*DT};
-    BPI.reset(new BranchProbabilityInfo(F, LI, TLI));
-    BFI.reset(new BlockFrequencyInfo(F, *BPI, LI));
-  }
+
+  LoopInfo LI{*DT};
+  auto BPI = std::make_unique<BranchProbabilityInfo>(F, LI, TLI);
+  auto BFI = std::make_unique<BlockFrequencyInfo>(F, *BPI, LI);
 
   JumpThreadingPass Impl;
   bool Changed = Impl.runImpl(F, nullptr, TLI, TTI, LVI, AA,


        


More information about the llvm-commits mailing list