[llvm] 503d577 - [JumpThreading][NFCI] Reuse existing DT instead of recomputation

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Sun May 29 22:50:37 PDT 2022


Author: Max Kazantsev
Date: 2022-05-30T12:48:10+07:00
New Revision: 503d5771b6c5e3544a9fa3be6b8d085ffbbd4057

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

LOG: [JumpThreading][NFCI] Reuse existing DT instead of recomputation

This whole part with recomputation of BPI and BFI looks redundant,
and we tried to get rid of it in D124439. Unfortunately, it causes
some hard-to-reproduce failures due to invalid state of analysis.
Until this is investigated and fixed, let's try to reuse at least
part of available analyzes.

DT is available at this point, and there is no need to recompute it.

Please revert if you see it causing *any* behavior changes.

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 a9e5b811f15d..b4b2b6cacd19 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -317,7 +317,7 @@ bool JumpThreading::runOnFunction(Function &F) {
   std::unique_ptr<BlockFrequencyInfo> BFI;
   std::unique_ptr<BranchProbabilityInfo> BPI;
   if (F.hasProfileData()) {
-    LoopInfo LI{DominatorTree(F)};
+    LoopInfo LI{*DT};
     BPI.reset(new BranchProbabilityInfo(F, LI, TLI));
     BFI.reset(new BlockFrequencyInfo(F, *BPI, LI));
   }


        


More information about the llvm-commits mailing list