From f55ed88936f3cdf0e9c0ac9c52761dd199b6ab2b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 18 Sep 2022 10:53:49 -0700 Subject: [PATCH] [mlir] Use x.empty() instead of llvm::empty(x) (NFC) I'm planning to deprecate and eventually remove llvm::empty. Note that no use of llvm::empty requires the ability of llvm::empty to determine the emptiness from begin/end only. --- mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp | 2 +- mlir/lib/IR/Block.cpp | 2 +- mlir/lib/IR/Operation.cpp | 4 ++-- mlir/lib/Rewrite/FrozenRewritePatternSet.cpp | 2 +- mlir/lib/Tools/PDLL/AST/NodePrinter.cpp | 4 ++-- mlir/lib/Transforms/Utils/DialectConversion.cpp | 2 +- mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp index a1e8e31..731e0e6 100644 --- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp +++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp @@ -46,7 +46,7 @@ using namespace mlir::vector; static Value buildMinMaxReductionSeq(Location loc, arith::CmpIPredicate predicate, ValueRange values, OpBuilder &builder) { - assert(!llvm::empty(values) && "empty min/max chain"); + assert(!values.empty() && "empty min/max chain"); auto valueIt = values.begin(); Value value = *valueIt++; diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp index cedbe19..dc4ec14 100644 --- a/mlir/lib/IR/Block.cpp +++ b/mlir/lib/IR/Block.cpp @@ -173,7 +173,7 @@ BlockArgument Block::insertArgument(unsigned index, Type type, Location loc) { /// Insert one value to the given position of the argument list. The existing /// arguments are shifted. The block is expected not to have predecessors. BlockArgument Block::insertArgument(args_iterator it, Type type, Location loc) { - assert(llvm::empty(getPredecessors()) && + assert(getPredecessors().empty() && "cannot insert arguments to blocks with predecessors"); return insertArgument(it->getArgNumber(), type, loc); } diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp index 886b5bb..219f1e2 100644 --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -1154,14 +1154,14 @@ impl::foldCastInterfaceOp(Operation *op, ArrayRef attrOperands, LogicalResult impl::verifyCastInterfaceOp( Operation *op, function_ref areCastCompatible) { auto resultTypes = op->getResultTypes(); - if (llvm::empty(resultTypes)) + if (resultTypes.empty()) return op->emitOpError() << "expected at least one result for cast operation"; auto operandTypes = op->getOperandTypes(); if (!areCastCompatible(operandTypes, resultTypes)) { InFlightDiagnostic diag = op->emitOpError("operand type"); - if (llvm::empty(operandTypes)) + if (operandTypes.empty()) diag << "s []"; else if (llvm::size(operandTypes) == 1) diag << " " << *operandTypes.begin(); diff --git a/mlir/lib/Rewrite/FrozenRewritePatternSet.cpp b/mlir/lib/Rewrite/FrozenRewritePatternSet.cpp index 7988150..7657825 100644 --- a/mlir/lib/Rewrite/FrozenRewritePatternSet.cpp +++ b/mlir/lib/Rewrite/FrozenRewritePatternSet.cpp @@ -18,7 +18,7 @@ using namespace mlir; static LogicalResult convertPDLToPDLInterp(ModuleOp pdlModule) { // Skip the conversion if the module doesn't contain pdl. - if (llvm::empty(pdlModule.getOps())) + if (pdlModule.getOps().empty()) return success(); // Simplify the provided PDL module. Note that we can't use the canonicalizer diff --git a/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp b/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp index 2be71b6..3b08f54 100644 --- a/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp +++ b/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp @@ -37,7 +37,7 @@ private: std::enable_if_t::value> * = nullptr> void printChildren(RangeT &&range) { - if (llvm::empty(range)) + if (range.empty()) return; // Print the first N-1 elements with a prefix of "|-". @@ -59,7 +59,7 @@ private: /// the given label. template void printChildren(StringRef label, RangeT &&range) { - if (llvm::empty(range)) + if (range.empty()) return; elementIndentStack.reserve(elementIndentStack.size() + 1); llvm::SaveAndRestore lastElement(elementIndentStack.back(), true); diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp index f2184d2..ccbfc78 100644 --- a/mlir/lib/Transforms/Utils/DialectConversion.cpp +++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -34,7 +34,7 @@ computeConversionSet(iterator_range region, Location regionLoc, SmallVectorImpl &toConvert, ConversionTarget *target = nullptr) { - if (llvm::empty(region)) + if (region.empty()) return success(); // Traverse starting from the entry block. diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index f9a5c85..ef0f094 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -2839,7 +2839,7 @@ void OpEmitter::genOpAsmInterface() { auto &body = method->body(); for (int i = 0; i != numResults; ++i) { body << " auto resultGroup" << i << " = getODSResults(" << i << ");\n" - << " if (!llvm::empty(resultGroup" << i << "))\n" + << " if (!resultGroup" << i << ".empty())\n" << " setNameFn(*resultGroup" << i << ".begin(), \"" << resultNames[i] << "\");\n"; } -- 2.7.4