From 0bdc72d2df87aec68d7a1920026bcc37422a823b Mon Sep 17 00:00:00 2001 From: Alex Zinenko Date: Tue, 17 Dec 2019 11:38:53 -0800 Subject: [PATCH] StdToLLVM conversion: drop getMemRefElementType utility function This function has become redundant with MemRefDescriptor::getElementType and is no longer necessary. Use the MemRefDescriptor pervasively to concentrate descriptor-related logic in one place and drop the utility function. PiperOrigin-RevId: 286024168 --- .../lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp index fa65120..9b2113a 100644 --- a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp @@ -253,17 +253,6 @@ Type LLVMTypeConverter::convertStandardType(Type type) { return {}; } -// Convert the element type of the memref `t` to to an LLVM type using -// `lowering`, get a pointer LLVM type pointing to the converted `t`, wrap it -// into the MLIR LLVM dialect type and return. -static Type getMemRefElementPtrType(MemRefType t, LLVMTypeConverter &lowering) { - auto elementType = t.getElementType(); - auto converted = lowering.convertType(elementType); - if (!converted) - return {}; - return converted.cast().getPointerTo(t.getMemorySpace()); -} - LLVMOpLowering::LLVMOpLowering(StringRef rootOpName, MLIRContext *context, LLVMTypeConverter &lowering_, PatternBenefit benefit) @@ -1429,7 +1418,7 @@ struct LoadStoreOpLowering : public LLVMLegalizationPattern { ArrayRef indices, ConversionPatternRewriter &rewriter, llvm::Module &module) const { - auto ptrType = getMemRefElementPtrType(type, this->lowering); + LLVM::LLVMType ptrType = MemRefDescriptor(memRefDesc).getElementType(); int64_t offset; SmallVector strides; auto successStrides = getStridesAndOffset(type, strides, offset); -- 2.7.4