Skip to content

Commit

Permalink
Refactor: Simplify boolean conditional return statements in llvm/lib/…
Browse files Browse the repository at this point in the history
…Analysis

Patch by Richard Thomson!

Differential revision: http://reviews.llvm.org/D9967


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252209 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
alexfh committed Nov 5, 2015
1 parent e6d3aa4 commit 981f179
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
5 changes: 1 addition & 4 deletions lib/Analysis/BasicAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,7 @@ ModRefInfo BasicAAResult::getArgModRefInfo(ImmutableCallSite CS,

static bool isAssumeIntrinsic(ImmutableCallSite CS) {
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction());
if (II && II->getIntrinsicID() == Intrinsic::assume)
return true;

return false;
return II && II->getIntrinsicID() == Intrinsic::assume;
}

#ifndef NDEBUG
Expand Down
5 changes: 1 addition & 4 deletions lib/Analysis/CaptureTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ namespace {

SmallVector<BasicBlock*, 32> Worklist;
Worklist.append(succ_begin(BB), succ_end(BB));
if (!isPotentiallyReachableFromMany(Worklist, BB, DT))
return true;

return false;
return !isPotentiallyReachableFromMany(Worklist, BB, DT);
}

// If the value is defined in the same basic block as use and BeforeHere,
Expand Down
5 changes: 1 addition & 4 deletions lib/Analysis/CostModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ static bool matchPairwiseShuffleMask(ShuffleVectorInst *SI, bool IsLeft,
Mask[i] = val;

SmallVector<int, 16> ActualMask = SI->getShuffleMask();
if (Mask != ActualMask)
return false;

return true;
return Mask == ActualMask;
}

static bool matchPairwiseReductionAtLevel(const BinaryOperator *BinOp,
Expand Down
9 changes: 3 additions & 6 deletions lib/Analysis/ScalarEvolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7419,12 +7419,9 @@ bool ScalarEvolution::isKnownPredicateViaSplitting(ICmpInst::Predicate Pred,
// expensive; and using isKnownNonNegative(RHS) is sufficient for most of the
// interesting cases seen in practice. We can consider "upgrading" L >= 0 to
// use isKnownPredicate later if needed.
if (isKnownNonNegative(RHS) &&
isKnownPredicate(CmpInst::ICMP_SGE, LHS, getZero(LHS->getType())) &&
isKnownPredicate(CmpInst::ICMP_SLT, LHS, RHS))
return true;

return false;
return isKnownNonNegative(RHS) &&
isKnownPredicate(CmpInst::ICMP_SGE, LHS, getZero(LHS->getType())) &&
isKnownPredicate(CmpInst::ICMP_SLT, LHS, RHS);
}

/// isLoopBackedgeGuardedByCond - Test whether the backedge of the loop is
Expand Down

0 comments on commit 981f179

Please sign in to comment.