r265918 - Remove redundant conditions of the form (A || (!A && B)) -> (A || B)
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 11 01:26:17 PDT 2016
Author: d0k
Date: Mon Apr 11 03:26:13 2016
New Revision: 265918
URL: http://llvm.org/viewvc/llvm-project?rev=265918&view=rev
Log:
Remove redundant conditions of the form (A || (!A && B)) -> (A || B)
Found by cppcheck! PR27286 PR27287 PR27288 PR27289
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=265918&r1=265917&r2=265918&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Apr 11 03:26:13 2016
@@ -2994,7 +2994,7 @@ LValue CodeGenFunction::EmitOMPArraySect
else
ResultExprTy = BaseTy->getPointeeType();
llvm::Value *Idx = nullptr;
- if (IsLowerBound || (!IsLowerBound && E->getColonLoc().isInvalid())) {
+ if (IsLowerBound || E->getColonLoc().isInvalid()) {
// Requesting lower bound or upper bound, but without provided length and
// without ':' symbol for the default length -> length = 1.
// Idx = LowerBound ?: 0;
Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=265918&r1=265917&r2=265918&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Mon Apr 11 03:26:13 2016
@@ -1596,8 +1596,7 @@ OMPClause *Parser::ParseOpenMPVarListCla
(Kind != OMPC_map)) ||
((Kind == OMPC_reduction) && !InvalidReductionId) ||
((Kind == OMPC_map) && (MapType != OMPC_MAP_unknown) &&
- (!MapTypeModifierSpecified ||
- (MapTypeModifierSpecified && MapTypeModifier == OMPC_MAP_always))) ||
+ (!MapTypeModifierSpecified || MapTypeModifier == OMPC_MAP_always)) ||
((Kind == OMPC_depend) && DepKind != OMPC_DEPEND_unknown);
const bool MayHaveTail = (Kind == OMPC_linear || Kind == OMPC_aligned);
while (IsComma || (Tok.isNot(tok::r_paren) && Tok.isNot(tok::colon) &&
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=265918&r1=265917&r2=265918&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Apr 11 03:26:13 2016
@@ -1828,8 +1828,7 @@ bool Sema::IsIntegralPromotion(Expr *Fro
(FromType->isSignedIntegerType() ||
// We can promote any unsigned integer type whose size is
// less than int to an int.
- (!FromType->isSignedIntegerType() &&
- Context.getTypeSize(FromType) < Context.getTypeSize(ToType)))) {
+ Context.getTypeSize(FromType) < Context.getTypeSize(ToType))) {
return To->getKind() == BuiltinType::Int;
}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp?rev=265918&r1=265917&r2=265918&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp Mon Apr 11 03:26:13 2016
@@ -582,8 +582,7 @@ void IvarInvalidationCheckerImpl::Method
// If InvalidationMethod is present, we are processing the message send and
// should ensure we are invalidating with the appropriate method,
// otherwise, we are processing setting to 'nil'.
- if (!InvalidationMethod ||
- (InvalidationMethod && I->second.hasMethod(InvalidationMethod)))
+ if (!InvalidationMethod || I->second.hasMethod(InvalidationMethod))
IVars.erase(I);
}
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp?rev=265918&r1=265917&r2=265918&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp Mon Apr 11 03:26:13 2016
@@ -1130,11 +1130,10 @@ void invalidateRegionsWorker::VisitClust
// Check offset is not symbolic and within array's boundaries.
// Handles arrays of 0 elements and of 0-sized elements as well.
if (!ROffset ||
- (ROffset &&
- ((*ROffset >= LowerOffset && *ROffset < UpperOffset) ||
- (UpperOverflow &&
- (*ROffset >= LowerOffset || *ROffset < UpperOffset)) ||
- (LowerOffset == UpperOffset && *ROffset == LowerOffset)))) {
+ ((*ROffset >= LowerOffset && *ROffset < UpperOffset) ||
+ (UpperOverflow &&
+ (*ROffset >= LowerOffset || *ROffset < UpperOffset)) ||
+ (LowerOffset == UpperOffset && *ROffset == LowerOffset))) {
B = B.removeBinding(I.getKey());
// Bound symbolic regions need to be invalidated for dead symbol
// detection.
More information about the cfe-commits
mailing list