forked from OSchip/llvm-project
[mlir] Rename ConvertToLLVMPattern::isSupportedMemRefType() to isConvertibleAndHasIdentityMaps().
Reviewed By: ftynse, herhut Differential Revision: https://reviews.llvm.org/D93752
This commit is contained in:
parent
32a884c9c5
commit
19a0d0a40c
|
@ -512,8 +512,9 @@ protected:
|
|||
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;
|
||||
|
|
|
@ -369,7 +369,7 @@ LogicalResult ConvertAllocOpToGpuRuntimeCallPattern::matchAndRewrite(
|
|||
MemRefType memRefType = allocOp.getType();
|
||||
|
||||
if (failed(areAllLLVMTypes(allocOp, operands, rewriter)) ||
|
||||
!isSupportedMemRefType(memRefType) ||
|
||||
!isConvertibleAndHasIdentityMaps(memRefType) ||
|
||||
failed(isAsyncWithOneDependency(rewriter, allocOp)))
|
||||
return failure();
|
||||
|
||||
|
@ -670,7 +670,7 @@ LogicalResult ConvertMemcpyOpToGpuRuntimeCallPattern::matchAndRewrite(
|
|||
auto memRefType = memcpyOp.src().getType().cast<MemRefType>();
|
||||
|
||||
if (failed(areAllLLVMTypes(memcpyOp, operands, rewriter)) ||
|
||||
!isSupportedMemRefType(memRefType) ||
|
||||
!isConvertibleAndHasIdentityMaps(memRefType) ||
|
||||
failed(isAsyncWithOneDependency(rewriter, memcpyOp)))
|
||||
return failure();
|
||||
|
||||
|
|
|
@ -1087,7 +1087,8 @@ Value ConvertToLLVMPattern::getStridedElementPtr(
|
|||
|
||||
// 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() ||
|
||||
|
@ -1105,7 +1106,7 @@ void ConvertToLLVMPattern::getMemRefDescriptorSizes(
|
|||
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());
|
||||
|
@ -1977,7 +1978,7 @@ private:
|
|||
|
||||
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
|
||||
|
@ -2411,7 +2412,7 @@ struct GlobalMemrefOpLowering : public ConvertOpToLLVMPattern<GlobalMemrefOp> {
|
|||
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 =
|
||||
|
@ -3031,12 +3032,12 @@ struct RankOpLowering : public ConvertOpToLLVMPattern<RankOp> {
|
|||
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();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue