[DivergenceAnalysis] Fix static analyzer warning about dereference of nullptr

We're testing that the RegionLoop pointer is null in the first part of the check, so we need to check that its non-null before dereferencing it in a later part of the check.
This commit is contained in:
Simon Pilgrim 2022-01-08 13:57:33 +00:00
parent 274359cf09
commit b3f193a980
1 changed files with 2 additions and 1 deletions

View File

@ -130,7 +130,8 @@ bool DivergenceAnalysisImpl::inRegion(const Instruction &I) const {
}
bool DivergenceAnalysisImpl::inRegion(const BasicBlock &BB) const {
return (!RegionLoop && BB.getParent() == &F) || RegionLoop->contains(&BB);
return (!RegionLoop && BB.getParent() == &F) ||
(RegionLoop && RegionLoop->contains(&BB));
}
void DivergenceAnalysisImpl::pushUsers(const Value &V) {