diff --git a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h --- a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h +++ b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h @@ -90,6 +90,9 @@ /// to each of the MLIR types converted with `convertType`. Type packFunctionResults(ArrayRef types); + /// Returns the MLIR context. + MLIRContext &getContext(); + /// Returns the LLVM context. llvm::LLVMContext &getLLVMContext(); @@ -356,6 +359,7 @@ /// `unpack`. static unsigned getNumUnpackedValues() { return 2; } }; + /// Base class for operation conversions targeting the LLVM IR dialect. Provides /// conversion patterns with access to an LLVMTypeConverter. class ConvertToLLVMPattern : public ConversionPattern { @@ -364,11 +368,79 @@ LLVMTypeConverter &typeConverter, PatternBenefit benefit = 1); + /// Returns the LLVM dialect. + LLVM::LLVMDialect &getDialect() const; + + /// Returns the LLVM IR context. + llvm::LLVMContext &getContext() const; + + /// Returns the LLVM IR module associated with the LLVM dialect. + llvm::Module &getModule() const; + + /// Gets the MLIR type wrapping the LLVM integer type whose bit width is + /// defined by the pointer size used in the LLVM module. + LLVM::LLVMType getIndexType() const; + + /// Gets the MLIR type wrapping the LLVM void type. + LLVM::LLVMType getVoidType() const; + + /// Get the MLIR type wrapping the LLVM i8* type. + LLVM::LLVMType getVoidPtrType() const; + + /// Create an LLVM dialect operation defining the given index constant. + Value createIndexConstant(ConversionPatternRewriter &builder, Location loc, + uint64_t value) const; + protected: /// Reference to the type converter, with potential extensions. LLVMTypeConverter &typeConverter; }; +/// Utility class for operation conversions targeting the LLVM dialect that +/// match exactly one source operation. +template +class ConvertOpToLLVMPattern : public ConvertToLLVMPattern { +public: + ConvertOpToLLVMPattern(LLVMTypeConverter &typeConverter, + PatternBenefit benefit = 1) + : ConvertToLLVMPattern(OpTy::getOperationName(), + &typeConverter.getContext(), typeConverter, + benefit) {} +}; + +namespace LLVM { +namespace detail { +/// Replaces the given operaiton "op" with a new operation of type "targetOp" +/// and given operands. +LogicalResult oneToOneRewrite(Operation *op, StringRef targetOp, + ValueRange operands, + LLVMTypeConverter &typeConverter, + ConversionPatternRewriter &rewriter); +} // namespace detail +} // namespace LLVM + +/// Generic implementation of one-to-one conversion from "SourceOp" to +/// "TargetOp" where the latter belongs to the LLVM dialect or an equivalent. +/// Upholds a convention that multi-result operations get converted into an +/// operation returning the LLVM IR structure type, in which case individual +/// values must be extacted from using LLVM::ExtractValueOp before being used. +template +class OneToOneConvertToLLVMPattern : public ConvertOpToLLVMPattern { +public: + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using Super = OneToOneConvertToLLVMPattern; + + /// Converts the type of the result to an LLVM type, pass operands as is, + /// preserve attributes. + LogicalResult + matchAndRewrite(Operation *op, ArrayRef operands, + ConversionPatternRewriter &rewriter) const override { + return LLVM::detail::oneToOneRewrite(op, TargetOp::getOperationName(), + operands, this->typeConverter, + rewriter); + } +}; + /// Derived class that automatically populates legalization information for /// different LLVM ops. class LLVMConversionTarget : public ConversionTarget { diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp --- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp @@ -148,6 +148,11 @@ addConversion([](LLVM::LLVMType type) { return type; }); } +/// Returns the MLIR context. +MLIRContext &LLVMTypeConverter::getContext() { + return *getDialect()->getContext(); +} + /// Get the LLVM context. llvm::LLVMContext &LLVMTypeConverter::getLLVMContext() { return module->getContext(); @@ -699,52 +704,35 @@ results.push_back(d.memRefDescPtr(builder, loc)); } -namespace { -// Base class for Standard to LLVM IR op conversions. Matches the Op type -// provided as template argument. Carries a reference to the LLVM dialect in -// case it is necessary for rewriters. -template -class LLVMLegalizationPattern : public ConvertToLLVMPattern { -public: - // Construct a conversion pattern. - explicit LLVMLegalizationPattern(LLVM::LLVMDialect &dialect_, - LLVMTypeConverter &typeConverter_) - : ConvertToLLVMPattern(SourceOp::getOperationName(), - dialect_.getContext(), typeConverter_), - dialect(dialect_) {} - - // Get the LLVM IR dialect. - LLVM::LLVMDialect &getDialect() const { return dialect; } - // Get the LLVM context. - llvm::LLVMContext &getContext() const { return dialect.getLLVMContext(); } - // Get the LLVM module in which the types are constructed. - llvm::Module &getModule() const { return dialect.getLLVMModule(); } - - // Get the MLIR type wrapping the LLVM integer type whose bit width is defined - // by the pointer size used in the LLVM module. - LLVM::LLVMType getIndexType() const { - return LLVM::LLVMType::getIntNTy( - &dialect, getModule().getDataLayout().getPointerSizeInBits()); - } +LLVM::LLVMDialect &ConvertToLLVMPattern::getDialect() const { + return *typeConverter.getDialect(); +} - LLVM::LLVMType getVoidType() const { - return LLVM::LLVMType::getVoidTy(&dialect); - } +llvm::LLVMContext &ConvertToLLVMPattern::getContext() const { + return typeConverter.getLLVMContext(); +} - // Get the MLIR type wrapping the LLVM i8* type. - LLVM::LLVMType getVoidPtrType() const { - return LLVM::LLVMType::getInt8PtrTy(&dialect); - } +llvm::Module &ConvertToLLVMPattern::getModule() const { + return getDialect().getLLVMModule(); +} - // Create an LLVM IR pseudo-operation defining the given index constant. - Value createIndexConstant(ConversionPatternRewriter &builder, Location loc, - uint64_t value) const { - return createIndexAttrConstant(builder, loc, getIndexType(), value); - } +LLVM::LLVMType ConvertToLLVMPattern::getIndexType() const { + return LLVM::LLVMType::getIntNTy( + &getDialect(), getModule().getDataLayout().getPointerSizeInBits()); +} -protected: - LLVM::LLVMDialect &dialect; -}; +LLVM::LLVMType ConvertToLLVMPattern::getVoidType() const { + return LLVM::LLVMType::getVoidTy(&getDialect()); +} + +LLVM::LLVMType ConvertToLLVMPattern::getVoidPtrType() const { + return LLVM::LLVMType::getInt8PtrTy(&getDialect()); +} + +Value ConvertToLLVMPattern::createIndexConstant( + ConversionPatternRewriter &builder, Location loc, uint64_t value) const { + return createIndexAttrConstant(builder, loc, getIndexType(), value); +} /// Only retain those attributes that are not constructed by /// `LLVMFuncOp::build`. If `filterArgAttrs` is set, also filter out argument @@ -876,9 +864,11 @@ builder.create(loc, call.getResults()); } -struct FuncOpConversionBase : public LLVMLegalizationPattern { +namespace { + +struct FuncOpConversionBase : public ConvertOpToLLVMPattern { protected: - using LLVMLegalizationPattern::LLVMLegalizationPattern; + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; using UnsignedTypePair = std::pair; // Gather the positions and types of memref-typed arguments in a given @@ -942,9 +932,8 @@ /// MemRef descriptors (LLVM struct data types) containing all the MemRef type /// information. struct FuncOpConversion : public FuncOpConversionBase { - FuncOpConversion(LLVM::LLVMDialect &dialect, LLVMTypeConverter &converter, - bool emitCWrappers) - : FuncOpConversionBase(dialect, converter), emitWrappers(emitCWrappers) {} + FuncOpConversion(LLVMTypeConverter &converter, bool emitCWrappers) + : FuncOpConversionBase(converter), emitWrappers(emitCWrappers) {} LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1022,7 +1011,6 @@ }; //////////////// Support for Lowering operations on n-D vectors //////////////// -namespace { // Helper struct to "unroll" operations on n-D vectors in terms of operations on // 1-D LLVM vectors. struct NDVectorTypeInfo { @@ -1098,55 +1086,49 @@ fun(position); } } -////////////// End Support for Lowering operations on n-D vectors ////////////// - -// Basic lowering implementation for one-to-one rewriting from Standard Ops to -// LLVM Dialect Ops. -template -struct OneToOneLLVMOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; - using Super = OneToOneLLVMOpLowering; - - // Convert the type of the result to an LLVM type, pass operands as is, - // preserve attributes. - LogicalResult - matchAndRewrite(Operation *op, ArrayRef operands, - ConversionPatternRewriter &rewriter) const override { - unsigned numResults = op->getNumResults(); - - Type packedType; - if (numResults != 0) { - packedType = - this->typeConverter.packFunctionResults(op->getResultTypes()); - if (!packedType) - return failure(); - } - auto newOp = rewriter.create(op->getLoc(), packedType, operands, - op->getAttrs()); +/// Replaces the given operaiton "op" with a new operation of type "targetOp" +/// and given operands. +LogicalResult LLVM::detail::oneToOneRewrite( + Operation *op, StringRef targetOp, ValueRange operands, + LLVMTypeConverter &typeConverter, ConversionPatternRewriter &rewriter) { + unsigned numResults = op->getNumResults(); - // If the operation produced 0 or 1 result, return them immediately. - if (numResults == 0) - return rewriter.eraseOp(op), success(); - if (numResults == 1) - return rewriter.replaceOp(op, newOp.getOperation()->getResult(0)), - success(); + Type packedType; + if (numResults != 0) { + packedType = typeConverter.packFunctionResults(op->getResultTypes()); + if (!packedType) + return failure(); + } - // Otherwise, it had been converted to an operation producing a structure. - // Extract individual results from the structure and return them as list. - SmallVector results; - results.reserve(numResults); - for (unsigned i = 0; i < numResults; ++i) { - auto type = this->typeConverter.convertType(op->getResult(i).getType()); - results.push_back(rewriter.create( - op->getLoc(), type, newOp.getOperation()->getResult(0), - rewriter.getI64ArrayAttr(i))); - } - rewriter.replaceOp(op, results); - return success(); + // Create the operation through state since we don't know its C++ type. + OperationState state(op->getLoc(), targetOp); + state.addTypes(packedType); + state.addOperands(operands); + state.addAttributes(op->getAttrs()); + Operation *newOp = rewriter.createOperation(state); + + // If the operation produced 0 or 1 result, return them immediately. + if (numResults == 0) + return rewriter.eraseOp(op), success(); + if (numResults == 1) + return rewriter.replaceOp(op, newOp->getResult(0)), success(); + + // Otherwise, it had been converted to an operation producing a structure. + // Extract individual results from the structure and return them as list. + SmallVector results; + results.reserve(numResults); + for (unsigned i = 0; i < numResults; ++i) { + auto type = typeConverter.convertType(op->getResult(i).getType()); + results.push_back(rewriter.create( + op->getLoc(), type, newOp->getResult(0), rewriter.getI64ArrayAttr(i))); } -}; + rewriter.replaceOp(op, results); + return success(); +} +////////////// End Support for Lowering operations on n-D vectors ////////////// +namespace { template struct OpCountValidator { static_assert( @@ -1201,8 +1183,8 @@ // Ops for N-ary ops with one result. This supports higher-dimensional vector // types. template -struct NaryOpLLVMOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct NaryOpLLVMOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; using Super = NaryOpLLVMOpLowering; // Convert the type of the result to an LLVM type, pass operands as is, @@ -1333,23 +1315,23 @@ using Super::Super; }; struct SelectOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct ConstLLVMOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct ShiftLeftOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct SignedShiftRightOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct UnsignedShiftRightOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; @@ -1373,13 +1355,11 @@ // Alignment is obtained by allocating `alignment - 1` more bytes than requested // and shifting the aligned pointer relative to the allocated memory. If // alignment is unspecified, the two pointers are equal. -struct AllocOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct AllocOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; - AllocOpLowering(LLVM::LLVMDialect &dialect_, LLVMTypeConverter &converter, - bool useAlloca = false) - : LLVMLegalizationPattern(dialect_, converter), - useAlloca(useAlloca) {} + explicit AllocOpLowering(LLVMTypeConverter &converter, bool useAlloca = false) + : ConvertOpToLLVMPattern(converter), useAlloca(useAlloca) {} LogicalResult match(Operation *op) const override { MemRefType type = cast(op).getType(); @@ -1569,10 +1549,10 @@ // A CallOp automatically promotes MemRefType to a sequence of alloca/store and // passes the pointer to the MemRef across function boundaries. template -struct CallOpInterfaceLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct CallOpInterfaceLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; using Super = CallOpInterfaceLowering; - using Base = LLVMLegalizationPattern; + using Base = ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1639,13 +1619,12 @@ // A `dealloc` is converted into a call to `free` on the underlying data buffer. // The memref descriptor being an SSA value, there is no need to clean it up // in any way. -struct DeallocOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct DeallocOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; - DeallocOpLowering(LLVM::LLVMDialect &dialect_, LLVMTypeConverter &converter, - bool useAlloca = false) - : LLVMLegalizationPattern(dialect_, converter), - useAlloca(useAlloca) {} + explicit DeallocOpLowering(LLVMTypeConverter &converter, + bool useAlloca = false) + : ConvertOpToLLVMPattern(converter), useAlloca(useAlloca) {} LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1680,8 +1659,8 @@ }; // A `rsqrt` is converted into `1 / sqrt`. -struct RsqrtOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct RsqrtOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1737,8 +1716,8 @@ } }; -struct MemRefCastOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct MemRefCastOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult match(Operation *op) const override { auto memRefCastOp = cast(op); @@ -1833,8 +1812,8 @@ }; struct DialectCastOpLowering - : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; + : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1852,8 +1831,8 @@ // A `dim` is converted to a constant for static sizes and to an access to the // size stored in the memref descriptor for dynamic sizes. -struct DimOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct DimOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -1880,8 +1859,8 @@ // to supported MemRef types. Provides functionality to emit code accessing a // specific element of the underlying data buffer. template -struct LoadStoreOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct LoadStoreOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; using Base = LoadStoreOpLowering; LogicalResult match(Operation *op) const override { @@ -2029,8 +2008,8 @@ // an integer. If the bit width of the source and target integer types is the // same, just erase the cast. If the target type is wider, sign-extend the // value, otherwise truncate it. -struct IndexCastOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct IndexCastOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2064,8 +2043,8 @@ return static_cast(pred); } -struct CmpIOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct CmpIOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2083,8 +2062,8 @@ } }; -struct CmpFOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct CmpFOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2103,39 +2082,40 @@ }; struct SIToFPLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; -struct FPExtLowering : public OneToOneLLVMOpLowering { +struct FPExtLowering + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct FPTruncLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct SignExtendIOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct TruncateIOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; struct ZeroExtendIOpLowering - : public OneToOneLLVMOpLowering { + : public OneToOneConvertToLLVMPattern { using Super::Super; }; // Base class for LLVM IR lowering terminator operations with successors. template struct OneToOneLLVMTerminatorLowering - : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; + : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; using Super = OneToOneLLVMTerminatorLowering; LogicalResult @@ -2153,8 +2133,8 @@ // can only return 0 or 1 value, we pack multiple values into a structure type. // Emit `UndefOp` followed by `InsertValueOp`s to create such structure if // necessary before returning it -struct ReturnOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct ReturnOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2202,8 +2182,8 @@ // The Splat operation is lowered to an insertelement + a shufflevector // operation. Splat to only 1-d vector result types are lowered. -struct SplatOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct SplatOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2236,8 +2216,8 @@ // The Splat operation is lowered to an insertelement + a shufflevector // operation. Splat to only 2+-d vector result types are lowered by the // SplatNdOpLowering, the 1-d case is handled by SplatOpLowering. -struct SplatNdOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct SplatNdOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2290,8 +2270,8 @@ /// 2. Updates to the descriptor to introduce the data ptr, offset, size /// and stride. /// The subview op is replaced by the descriptor. -struct SubViewOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct SubViewOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2418,8 +2398,8 @@ /// 2. Updates to the descriptor to introduce the data ptr, offset, size /// and stride. /// The view op is replaced by the descriptor. -struct ViewOpLowering : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; +struct ViewOpLowering : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; // Build and return the value for the idx^th shape dimension, either by // returning the constant shape dimension or counting the proper dynamic size. @@ -2535,8 +2515,8 @@ }; struct AssumeAlignmentOpLowering - : public LLVMLegalizationPattern { - using LLVMLegalizationPattern::LLVMLegalizationPattern; + : public ConvertOpToLLVMPattern { + using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -2788,7 +2768,7 @@ UnsignedRemIOpLowering, UnsignedShiftRightOpLowering, XOrOpLowering, - ZeroExtendIOpLowering>(*converter.getDialect(), converter); + ZeroExtendIOpLowering>(converter); // clang-format on } @@ -2803,19 +2783,17 @@ MemRefCastOpLowering, StoreOpLowering, SubViewOpLowering, - ViewOpLowering>(*converter.getDialect(), converter); + ViewOpLowering>(converter); patterns.insert< AllocOpLowering, - DeallocOpLowering>( - *converter.getDialect(), converter, useAlloca); + DeallocOpLowering>(converter, useAlloca); // clang-format on } void mlir::populateStdToLLVMDefaultFuncOpConversionPattern( LLVMTypeConverter &converter, OwningRewritePatternList &patterns, bool emitCWrappers) { - patterns.insert(*converter.getDialect(), converter, - emitCWrappers); + patterns.insert(converter, emitCWrappers); } void mlir::populateStdToLLVMConversionPatterns( @@ -2829,7 +2807,7 @@ static void populateStdToLLVMBarePtrFuncOpConversionPattern( LLVMTypeConverter &converter, OwningRewritePatternList &patterns) { - patterns.insert(*converter.getDialect(), converter); + patterns.insert(converter); } void mlir::populateStdToLLVMBarePtrConversionPatterns(