*p << "*";
} else {
auto *v = getIndexing();
- if (isa_nonnull<RangeOp>(v->getDefiningOp())) {
+ if (isa_and_nonnull<RangeOp>(v->getDefiningOp())) {
*p << *v << "..";
} else {
*p << *v;
return op ? op->dyn_cast<T>() : T();
}
-/// Provide isa_nonnull functionality for Operation casts, i.e. if the operation
-/// is non-null and a class of 'T'.
-template <typename T> bool isa_nonnull(Operation *op) {
+/// Provide isa_and_nonnull functionality for Operation casts, i.e. if the
+/// operation is non-null and a class of 'T'.
+template <typename T> bool isa_and_nonnull(Operation *op) {
return op && op->isa<T>();
}
indicesFromAffineApplyOp(ArrayRef<Value *> operands) {
llvm::SetVector<unsigned> res;
for (auto en : llvm::enumerate(operands))
- if (isa_nonnull<AffineApplyOp>(en.value()->getDefiningOp()))
+ if (isa_and_nonnull<AffineApplyOp>(en.value()->getDefiningOp()))
res.insert(en.index());
return res;
}
void mlir::fullyComposeAffineMapAndOperands(
AffineMap *map, SmallVectorImpl<Value *> *operands) {
while (llvm::any_of(*operands, [](Value *v) {
- return isa_nonnull<AffineApplyOp>(v->getDefiningOp());
+ return isa_and_nonnull<AffineApplyOp>(v->getDefiningOp());
})) {
composeAffineMapAndOperands(map, operands);
}
auto *opInst = state.value->getDefiningOp();
// Note: getDefiningOp will return nullptr if the operand is not an
// Operation (i.e. block argument), which is a terminator for the search.
- if (!isa_nonnull<AffineApplyOp>(opInst)) {
+ if (!isa_and_nonnull<AffineApplyOp>(opInst)) {
worklist.pop_back();
continue;
}
// Check that the memref operand's defining operation is an AllocOp.
Value *memref = dealloc.getMemRef();
Operation *defOp = memref->getDefiningOp();
- if (!isa_nonnull<AllocOp>(defOp))
+ if (!isa_and_nonnull<AllocOp>(defOp))
return matchFailure();
// Check that all of the uses of the AllocOp are other DeallocOps.
continue;
// Use list expected to match the dep graph info.
auto *op = memref->getDefiningOp();
- if (isa_nonnull<AllocOp>(op))
+ if (isa_and_nonnull<AllocOp>(op))
op->erase();
}
}