forked from OSchip/llvm-project
[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.
This commit is contained in:
parent
3e720fa9dc
commit
f55ed88936
|
@ -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++;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1154,14 +1154,14 @@ impl::foldCastInterfaceOp(Operation *op, ArrayRef<Attribute> attrOperands,
|
|||
LogicalResult impl::verifyCastInterfaceOp(
|
||||
Operation *op, function_ref<bool(TypeRange, TypeRange)> 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();
|
||||
|
|
|
@ -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<pdl::PatternOp>()))
|
||||
if (pdlModule.getOps<pdl::PatternOp>().empty())
|
||||
return success();
|
||||
|
||||
// Simplify the provided PDL module. Note that we can't use the canonicalizer
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
std::enable_if_t<!std::is_convertible<RangeT, const Node *>::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 <typename RangeT>
|
||||
void printChildren(StringRef label, RangeT &&range) {
|
||||
if (llvm::empty(range))
|
||||
if (range.empty())
|
||||
return;
|
||||
elementIndentStack.reserve(elementIndentStack.size() + 1);
|
||||
llvm::SaveAndRestore<bool> lastElement(elementIndentStack.back(), true);
|
||||
|
|
|
@ -34,7 +34,7 @@ computeConversionSet(iterator_range<Region::iterator> region,
|
|||
Location regionLoc,
|
||||
SmallVectorImpl<Operation *> &toConvert,
|
||||
ConversionTarget *target = nullptr) {
|
||||
if (llvm::empty(region))
|
||||
if (region.empty())
|
||||
return success();
|
||||
|
||||
// Traverse starting from the entry block.
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue