diff --git a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp --- a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp +++ b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp @@ -59,7 +59,7 @@ // Gather all AffineForOps by loop depth. std::vector> depthToLoops; gatherLoops(getFunction(), depthToLoops); - assert(depthToLoops.size() && "Loop nest not found"); + assert(!depthToLoops.empty() && "Loop nest not found"); // Only support tests with a single loop nest and a single innermost loop // for now. diff --git a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp --- a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp +++ b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp @@ -43,18 +43,18 @@ static bool emitDecls(const RecordKeeper &recordKeeper, raw_ostream &os) { const auto &directiveLanguages = recordKeeper.getAllDerivedDefinitions("DirectiveLanguage"); - assert(directiveLanguages.size() != 0 && "DirectiveLanguage missing."); + assert(!directiveLanguages.empty() && "DirectiveLanguage missing."); const auto &clauses = recordKeeper.getAllDerivedDefinitions("Clause"); for (const auto &r : clauses) { Clause c{r}; const auto &clauseVals = c.getClauseVals(); - if (clauseVals.size() <= 0) + if (clauseVals.empty()) continue; const auto enumName = c.getEnumName(); - assert(enumName.size() != 0 && "enumClauseValue field not set."); + assert(!enumName.empty() && "enumClauseValue field not set."); std::vector cvDefs; for (const auto &cv : clauseVals) {