[DivergenceAnalysis] Simplify inRegion test based on whether the RegionLoop pointer...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 8 Jan 2022 14:30:10 +0000 (14:30 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 8 Jan 2022 14:30:10 +0000 (14:30 +0000)
More closely matches the documentation

Requested by @nikic

llvm/lib/Analysis/DivergenceAnalysis.cpp

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