Add parentheses in various asserts to group predicates

This addresses the "suggest parentheses around ‘&&’ within ‘||’
    [-Wparentheses]" compiler warnings.

--

PiperOrigin-RevId: 242868670
This commit is contained in:
Lei Zhang 2019-04-10 08:00:20 -07:00 committed by Mehdi Amini
parent 9ec5fcf1fa
commit 2e7895d5f1
3 changed files with 13 additions and 13 deletions

View File

@ -720,12 +720,12 @@ void AffineForOp::build(Builder *builder, OperationState *result,
ArrayRef<Value *> lbOperands, AffineMap lbMap,
ArrayRef<Value *> ubOperands, AffineMap ubMap,
int64_t step) {
assert((!lbMap && lbOperands.empty()) ||
lbOperands.size() == lbMap.getNumInputs() &&
"lower bound operand count does not match the affine map");
assert((!ubMap && ubOperands.empty()) ||
ubOperands.size() == ubMap.getNumInputs() &&
"upper bound operand count does not match the affine map");
assert(((!lbMap && lbOperands.empty()) ||
lbOperands.size() == lbMap.getNumInputs()) &&
"lower bound operand count does not match the affine map");
assert(((!ubMap && ubOperands.empty()) ||
ubOperands.size() == ubMap.getNumInputs()) &&
"upper bound operand count does not match the affine map");
assert(step > 0 && "step has to be a positive integer constant");
// Add an attribute for the step.

View File

@ -200,11 +200,10 @@ struct IntegerAttrKeyInfo : DenseMapInfo<IntegerAttributeStorage *> {
static bool isEqual(const KeyTy &lhs, const IntegerAttributeStorage *rhs) {
if (rhs == getEmptyKey() || rhs == getTombstoneKey())
return false;
assert(lhs.first.isIndex() ||
(lhs.first.isa<IntegerType>() &&
lhs.first.cast<IntegerType>().getWidth() ==
lhs.second.getBitWidth()) &&
"mismatching integer type and value bitwidth");
assert((lhs.first.isIndex() || (lhs.first.isa<IntegerType>() &&
lhs.first.cast<IntegerType>().getWidth() ==
lhs.second.getBitWidth())) &&
"mismatching integer type and value bitwidth");
return lhs.first == rhs->type && lhs.second == rhs->getValue();
}
};

View File

@ -183,8 +183,9 @@ clip(VectorTransferOpTy transfer, edsc::MemRefView &view,
auto expr = en.value();
auto dim = expr.template dyn_cast<AffineDimExpr>();
// Sanity check.
assert(dim || expr.template cast<AffineConstantExpr>().getValue() == 0 &&
"Expected dim or 0 in permutationMap");
assert(
(dim || expr.template cast<AffineConstantExpr>().getValue() == 0) &&
"Expected dim or 0 in permutationMap");
if (dim && memRefDim == dim.getPosition()) {
loopIndex = en.index();
break;