From 503d5771b6c5e3544a9fa3be6b8d085ffbbd4057 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Mon, 30 May 2022 12:48:10 +0700 Subject: [PATCH] [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. --- llvm/lib/Transforms/Scalar/JumpThreading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index a9e5b81..b4b2b6c 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 BFI; std::unique_ptr 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)); } -- 2.7.4