[llvm] e162a73 - [CFG] Add const qualifier to isPotentiallyReachableFromMany() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 18 01:06:15 PDT 2022
Author: Nikita Popov
Date: 2022-10-18T10:06:07+02:00
New Revision: e162a73e41402feab4b3870cc7074f053099da64
URL: https://github.com/llvm/llvm-project/commit/e162a73e41402feab4b3870cc7074f053099da64
DIFF: https://github.com/llvm/llvm-project/commit/e162a73e41402feab4b3870cc7074f053099da64.diff
LOG: [CFG] Add const qualifier to isPotentiallyReachableFromMany() (NFC)
Accept a const pointer for StopBB. Unfortunately the worklist has
to use non-const pointers due to LoopInfo interaction.
Added:
Modified:
llvm/include/llvm/Analysis/CFG.h
llvm/lib/Analysis/CFG.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/CFG.h b/llvm/include/llvm/Analysis/CFG.h
index b90258f8efff8..86b01c13274fe 100644
--- a/llvm/include/llvm/Analysis/CFG.h
+++ b/llvm/include/llvm/Analysis/CFG.h
@@ -92,7 +92,7 @@ bool isPotentiallyReachable(
/// in 'Worklist' has been reached then 'StopBB' can not be executed.
/// Conservatively returns true.
bool isPotentiallyReachableFromMany(
- SmallVectorImpl<BasicBlock *> &Worklist, BasicBlock *StopBB,
+ SmallVectorImpl<BasicBlock *> &Worklist, const BasicBlock *StopBB,
const SmallPtrSetImpl<BasicBlock *> *ExclusionSet,
const DominatorTree *DT = nullptr, const LoopInfo *LI = nullptr);
diff --git a/llvm/lib/Analysis/CFG.cpp b/llvm/lib/Analysis/CFG.cpp
index e5dd45842d6a1..8528aa9f77e02 100644
--- a/llvm/lib/Analysis/CFG.cpp
+++ b/llvm/lib/Analysis/CFG.cpp
@@ -131,7 +131,7 @@ static const Loop *getOutermostLoop(const LoopInfo *LI, const BasicBlock *BB) {
}
bool llvm::isPotentiallyReachableFromMany(
- SmallVectorImpl<BasicBlock *> &Worklist, BasicBlock *StopBB,
+ SmallVectorImpl<BasicBlock *> &Worklist, const BasicBlock *StopBB,
const SmallPtrSetImpl<BasicBlock *> *ExclusionSet, const DominatorTree *DT,
const LoopInfo *LI) {
// When the stop block is unreachable, it's dominated from everywhere,
@@ -225,8 +225,7 @@ bool llvm::isPotentiallyReachable(
SmallVector<BasicBlock*, 32> Worklist;
Worklist.push_back(const_cast<BasicBlock*>(A));
- return isPotentiallyReachableFromMany(Worklist, const_cast<BasicBlock *>(B),
- ExclusionSet, DT, LI);
+ return isPotentiallyReachableFromMany(Worklist, B, ExclusionSet, DT, LI);
}
bool llvm::isPotentiallyReachable(
@@ -266,9 +265,8 @@ bool llvm::isPotentiallyReachable(
return false;
}
- return isPotentiallyReachableFromMany(
- Worklist, const_cast<BasicBlock *>(B->getParent()), ExclusionSet,
- DT, LI);
+ return isPotentiallyReachableFromMany(Worklist, B->getParent(),
+ ExclusionSet, DT, LI);
}
return isPotentiallyReachable(
More information about the llvm-commits
mailing list