[PATCH] D9967: Refactor: Simplify boolean conditional return statements in llvm/lib/Analysis
Richard via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 24 13:33:13 PDT 2015
LegalizeAdulthood updated this revision to Diff 38326.
LegalizeAdulthood added a comment.
Update from latest.
Update from comments.
I do not have commit access.
http://reviews.llvm.org/D9967
Files:
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/CaptureTracking.cpp
lib/Analysis/CostModel.cpp
lib/Analysis/ScalarEvolution.cpp
Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -7228,12 +7228,9 @@
// 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
Index: lib/Analysis/CostModel.cpp
===================================================================
--- lib/Analysis/CostModel.cpp
+++ lib/Analysis/CostModel.cpp
@@ -152,10 +152,7 @@
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,
Index: lib/Analysis/CaptureTracking.cpp
===================================================================
--- lib/Analysis/CaptureTracking.cpp
+++ lib/Analysis/CaptureTracking.cpp
@@ -102,10 +102,7 @@
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,
Index: lib/Analysis/BasicAliasAnalysis.cpp
===================================================================
--- lib/Analysis/BasicAliasAnalysis.cpp
+++ lib/Analysis/BasicAliasAnalysis.cpp
@@ -621,10 +621,7 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9967.38326.patch
Type: text/x-patch
Size: 2401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151024/91f77cbb/attachment.bin>
More information about the llvm-commits
mailing list