[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.
This commit is contained in:
Nikita Popov 2022-10-18 10:05:12 +02:00
parent c28a977b87
commit e162a73e41
2 changed files with 5 additions and 7 deletions

View File

@ -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);

View File

@ -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(