Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions llvm/include/llvm/Transforms/Scalar/JumpThreading.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
LazyValueInfo *LVI = nullptr;
AAResults *AA = nullptr;
std::unique_ptr<DomTreeUpdater> DTU;
std::optional<BlockFrequencyInfo *> BFI;
std::optional<BranchProbabilityInfo *> BPI;
BlockFrequencyInfo *BFI = nullptr;
BranchProbabilityInfo *BPI = nullptr;
bool ChangedSinceLastAnalysisUpdate = false;
bool HasGuards = false;
#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS
Expand All @@ -110,8 +110,7 @@ class JumpThreadingPass : public PassInfoMixin<JumpThreadingPass> {
TargetLibraryInfo *TLI, TargetTransformInfo *TTI,
LazyValueInfo *LVI, AAResults *AA,
std::unique_ptr<DomTreeUpdater> DTU,
std::optional<BlockFrequencyInfo *> BFI,
std::optional<BranchProbabilityInfo *> BPI);
BlockFrequencyInfo *BFI, BranchProbabilityInfo *BPI);

LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

Expand Down
14 changes: 7 additions & 7 deletions llvm/lib/Transforms/Scalar/JumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ PreservedAnalyses JumpThreadingPass::run(Function &F,
runImpl(F, &AM, &TLI, &TTI, &LVI, &AA,
std::make_unique<DomTreeUpdater>(
&DT, nullptr, DomTreeUpdater::UpdateStrategy::Lazy),
std::nullopt, std::nullopt);
nullptr, nullptr);

if (!Changed)
return PreservedAnalyses::all();
Expand Down Expand Up @@ -283,8 +283,8 @@ bool JumpThreadingPass::runImpl(Function &F_, FunctionAnalysisManager *FAM_,
TargetTransformInfo *TTI_, LazyValueInfo *LVI_,
AliasAnalysis *AA_,
std::unique_ptr<DomTreeUpdater> DTU_,
std::optional<BlockFrequencyInfo *> BFI_,
std::optional<BranchProbabilityInfo *> BPI_) {
BlockFrequencyInfo *BFI_,
BranchProbabilityInfo *BPI_) {
LLVM_DEBUG(dbgs() << "Jump threading on function '" << F_.getName() << "'\n");
F = &F_;
FAM = FAM_;
Expand Down Expand Up @@ -3215,15 +3215,15 @@ BranchProbabilityInfo *JumpThreadingPass::getBPI() {
assert(FAM && "Can't create BPI without FunctionAnalysisManager");
BPI = FAM->getCachedResult<BranchProbabilityAnalysis>(*F);
}
return *BPI;
return BPI;
}

BlockFrequencyInfo *JumpThreadingPass::getBFI() {
if (!BFI) {
assert(FAM && "Can't create BFI without FunctionAnalysisManager");
BFI = FAM->getCachedResult<BlockFrequencyAnalysis>(*F);
}
return *BFI;
return BFI;
}

// Important note on validity of BPI/BFI. JumpThreading tries to preserve
Expand All @@ -3237,7 +3237,7 @@ BranchProbabilityInfo *JumpThreadingPass::getOrCreateBPI(bool Force) {
if (Force)
BPI = runExternalAnalysis<BranchProbabilityAnalysis>();

return *BPI;
return BPI;
}

BlockFrequencyInfo *JumpThreadingPass::getOrCreateBFI(bool Force) {
Expand All @@ -3248,5 +3248,5 @@ BlockFrequencyInfo *JumpThreadingPass::getOrCreateBFI(bool Force) {
if (Force)
BFI = runExternalAnalysis<BlockFrequencyAnalysis>();

return *BFI;
return BFI;
}