ValueRange indices,
ConversionPatternRewriter &rewriter) const;
- /// Returns if the givem memref type is supported.
- bool isSupportedMemRefType(MemRefType type) const;
+ /// Returns if the given memref has identity maps and the element type is
+ /// convertible to LLVM.
+ bool isConvertibleAndHasIdentityMaps(MemRefType type) const;
/// Returns the type of a pointer to an element of the memref.
Type getElementPtrType(MemRefType type) const;
MemRefType memRefType = allocOp.getType();
if (failed(areAllLLVMTypes(allocOp, operands, rewriter)) ||
- !isSupportedMemRefType(memRefType) ||
+ !isConvertibleAndHasIdentityMaps(memRefType) ||
failed(isAsyncWithOneDependency(rewriter, allocOp)))
return failure();
auto memRefType = memcpyOp.src().getType().cast<MemRefType>();
if (failed(areAllLLVMTypes(memcpyOp, operands, rewriter)) ||
- !isSupportedMemRefType(memRefType) ||
+ !isConvertibleAndHasIdentityMaps(memRefType) ||
failed(isAsyncWithOneDependency(rewriter, memcpyOp)))
return failure();
// Check if the MemRefType `type` is supported by the lowering. We currently
// only support memrefs with identity maps.
-bool ConvertToLLVMPattern::isSupportedMemRefType(MemRefType type) const {
+bool ConvertToLLVMPattern::isConvertibleAndHasIdentityMaps(
+ MemRefType type) const {
if (!typeConverter->convertType(type.getElementType()))
return false;
return type.getAffineMaps().empty() ||
Location loc, MemRefType memRefType, ArrayRef<Value> dynamicSizes,
ConversionPatternRewriter &rewriter, SmallVectorImpl<Value> &sizes,
SmallVectorImpl<Value> &strides, Value &sizeBytes) const {
- assert(isSupportedMemRefType(memRefType) &&
+ assert(isConvertibleAndHasIdentityMaps(memRefType) &&
"layout maps must have been normalized away");
sizes.reserve(memRefType.getRank());
LogicalResult match(Operation *op) const override {
MemRefType memRefType = getMemRefResultType(op);
- return success(isSupportedMemRefType(memRefType));
+ return success(isConvertibleAndHasIdentityMaps(memRefType));
}
// An `alloc` is converted into a definition of a memref descriptor value and
matchAndRewrite(GlobalMemrefOp global, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
MemRefType type = global.type().cast<MemRefType>();
- if (!isSupportedMemRefType(type))
+ if (!isConvertibleAndHasIdentityMaps(type))
return failure();
LLVM::LLVMType arrayTy =
template <typename Derived>
struct LoadStoreOpLowering : public ConvertOpToLLVMPattern<Derived> {
using ConvertOpToLLVMPattern<Derived>::ConvertOpToLLVMPattern;
- using ConvertOpToLLVMPattern<Derived>::isSupportedMemRefType;
+ using ConvertOpToLLVMPattern<Derived>::isConvertibleAndHasIdentityMaps;
using Base = LoadStoreOpLowering<Derived>;
LogicalResult match(Derived op) const override {
MemRefType type = op.getMemRefType();
- return isSupportedMemRefType(type) ? success() : failure();
+ return isConvertibleAndHasIdentityMaps(type) ? success() : failure();
}
};