[Mlir-commits] [mlir] [MLIR][AsyncToLLVM] Remove typed pointer support (PR #70731)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 30 14:50:11 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Christian Ulmann (Dinistro)

<details>
<summary>Changes</summary>

This commit removes the support for lowering Async to LLVM dialect with typed pointers. Typed pointers have been deprecated for a while now and it's planned to soon remove them from the LLVM dialect.

Related PSA: https://discourse.llvm.org/t/psa-removal-of-typed-pointers-from-the-llvm-dialect/74502

---

Patch is 31.56 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/70731.diff


7 Files Affected:

- (modified) mlir/include/mlir/Conversion/Passes.td (-5) 
- (modified) mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h (+3-2) 
- (modified) mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp (+75-164) 
- (modified) mlir/test/Conversion/AsyncToLLVM/convert-coro-to-llvm.mlir (+1-1) 
- (modified) mlir/test/Conversion/AsyncToLLVM/convert-runtime-to-llvm.mlir (+1-1) 
- (modified) mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir (+1-1) 
- (removed) mlir/test/Conversion/AsyncToLLVM/typed-pointers.mlir (-138) 


``````````diff
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index cf6e545749ffc64..74ac7135083f853 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -191,11 +191,6 @@ def ConvertAsyncToLLVMPass : Pass<"convert-async-to-llvm", "ModuleOp"> {
     "LLVM::LLVMDialect",
     "func::FuncDialect",
   ];
-  let options = [
-    Option<"useOpaquePointers", "use-opaque-pointers", "bool",
-           /*default=*/"true", "Generate LLVM IR using opaque pointers "
-           "instead of typed pointers">,
-  ];
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h b/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
index 9e69717f471bce2..05320c0c7186907 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
@@ -52,8 +52,9 @@ LLVM::LLVMFuncOp lookupOrCreatePrintNewlineFn(ModuleOp moduleOp);
 LLVM::LLVMFuncOp lookupOrCreateMallocFn(ModuleOp moduleOp, Type indexType,
                                         bool opaquePointers);
 LLVM::LLVMFuncOp lookupOrCreateAlignedAllocFn(ModuleOp moduleOp, Type indexType,
-                                              bool opaquePointers);
-LLVM::LLVMFuncOp lookupOrCreateFreeFn(ModuleOp moduleOp, bool opaquePointers);
+                                              bool opaquePointers = true);
+LLVM::LLVMFuncOp lookupOrCreateFreeFn(ModuleOp moduleOp,
+                                      bool opaquePointers = true);
 LLVM::LLVMFuncOp lookupOrCreateGenericAllocFn(ModuleOp moduleOp, Type indexType,
                                               bool opaquePointers);
 LLVM::LLVMFuncOp lookupOrCreateGenericAlignedAllocFn(ModuleOp moduleOp,
diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index d9ea60a6749d926..3e61c9c7de50e2f 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -76,20 +76,16 @@ namespace {
 /// lowering all async data types become opaque pointers at runtime.
 struct AsyncAPI {
   // All async types are lowered to opaque LLVM pointers at runtime.
-  static LLVM::LLVMPointerType opaquePointerType(MLIRContext *ctx,
-                                                 bool useLLVMOpaquePointers) {
-    if (useLLVMOpaquePointers)
-      return LLVM::LLVMPointerType::get(ctx);
-    return LLVM::LLVMPointerType::get(IntegerType::get(ctx, 8));
+  static LLVM::LLVMPointerType opaquePointerType(MLIRContext *ctx) {
+    return LLVM::LLVMPointerType::get(ctx);
   }
 
   static LLVM::LLVMTokenType tokenType(MLIRContext *ctx) {
     return LLVM::LLVMTokenType::get(ctx);
   }
 
-  static FunctionType addOrDropRefFunctionType(MLIRContext *ctx,
-                                               bool useLLVMOpaquePointers) {
-    auto ref = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType addOrDropRefFunctionType(MLIRContext *ctx) {
+    auto ref = opaquePointerType(ctx);
     auto count = IntegerType::get(ctx, 64);
     return FunctionType::get(ctx, {ref, count}, {});
   }
@@ -98,10 +94,9 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {}, {TokenType::get(ctx)});
   }
 
-  static FunctionType createValueFunctionType(MLIRContext *ctx,
-                                              bool useLLVMOpaquePointers) {
+  static FunctionType createValueFunctionType(MLIRContext *ctx) {
     auto i64 = IntegerType::get(ctx, 64);
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
+    auto value = opaquePointerType(ctx);
     return FunctionType::get(ctx, {i64}, {value});
   }
 
@@ -110,10 +105,9 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {i64}, {GroupType::get(ctx)});
   }
 
-  static FunctionType getValueStorageFunctionType(MLIRContext *ctx,
-                                                  bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
-    auto storage = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType getValueStorageFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
+    auto storage = opaquePointerType(ctx);
     return FunctionType::get(ctx, {value}, {storage});
   }
 
@@ -121,9 +115,8 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {TokenType::get(ctx)}, {});
   }
 
-  static FunctionType emplaceValueFunctionType(MLIRContext *ctx,
-                                               bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType emplaceValueFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
     return FunctionType::get(ctx, {value}, {});
   }
 
@@ -131,9 +124,8 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {TokenType::get(ctx)}, {});
   }
 
-  static FunctionType setValueErrorFunctionType(MLIRContext *ctx,
-                                                bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType setValueErrorFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
     return FunctionType::get(ctx, {value}, {});
   }
 
@@ -142,9 +134,8 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {TokenType::get(ctx)}, {i1});
   }
 
-  static FunctionType isValueErrorFunctionType(MLIRContext *ctx,
-                                               bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType isValueErrorFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
     auto i1 = IntegerType::get(ctx, 1);
     return FunctionType::get(ctx, {value}, {i1});
   }
@@ -158,9 +149,8 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {TokenType::get(ctx)}, {});
   }
 
-  static FunctionType awaitValueFunctionType(MLIRContext *ctx,
-                                             bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
+  static FunctionType awaitValueFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
     return FunctionType::get(ctx, {value}, {});
   }
 
@@ -168,15 +158,9 @@ struct AsyncAPI {
     return FunctionType::get(ctx, {GroupType::get(ctx)}, {});
   }
 
-  static FunctionType executeFunctionType(MLIRContext *ctx,
-                                          bool useLLVMOpaquePointers) {
-    auto hdl = opaquePointerType(ctx, useLLVMOpaquePointers);
-    Type resume;
-    if (useLLVMOpaquePointers)
-      resume = LLVM::LLVMPointerType::get(ctx);
-    else
-      resume = LLVM::LLVMPointerType::get(
-          resumeFunctionType(ctx, useLLVMOpaquePointers));
+  static FunctionType executeFunctionType(MLIRContext *ctx) {
+    auto hdl = opaquePointerType(ctx);
+    Type resume = AsyncAPI::opaquePointerType(ctx);
     return FunctionType::get(ctx, {hdl, resume}, {});
   }
 
@@ -186,42 +170,22 @@ struct AsyncAPI {
                              {i64});
   }
 
-  static FunctionType
-  awaitTokenAndExecuteFunctionType(MLIRContext *ctx,
-                                   bool useLLVMOpaquePointers) {
-    auto hdl = opaquePointerType(ctx, useLLVMOpaquePointers);
-    Type resume;
-    if (useLLVMOpaquePointers)
-      resume = LLVM::LLVMPointerType::get(ctx);
-    else
-      resume = LLVM::LLVMPointerType::get(
-          resumeFunctionType(ctx, useLLVMOpaquePointers));
+  static FunctionType awaitTokenAndExecuteFunctionType(MLIRContext *ctx) {
+    auto hdl = opaquePointerType(ctx);
+    Type resume = AsyncAPI::opaquePointerType(ctx);
     return FunctionType::get(ctx, {TokenType::get(ctx), hdl, resume}, {});
   }
 
-  static FunctionType
-  awaitValueAndExecuteFunctionType(MLIRContext *ctx,
-                                   bool useLLVMOpaquePointers) {
-    auto value = opaquePointerType(ctx, useLLVMOpaquePointers);
-    auto hdl = opaquePointerType(ctx, useLLVMOpaquePointers);
-    Type resume;
-    if (useLLVMOpaquePointers)
-      resume = LLVM::LLVMPointerType::get(ctx);
-    else
-      resume = LLVM::LLVMPointerType::get(
-          resumeFunctionType(ctx, useLLVMOpaquePointers));
+  static FunctionType awaitValueAndExecuteFunctionType(MLIRContext *ctx) {
+    auto value = opaquePointerType(ctx);
+    auto hdl = opaquePointerType(ctx);
+    Type resume = AsyncAPI::opaquePointerType(ctx);
     return FunctionType::get(ctx, {value, hdl, resume}, {});
   }
 
-  static FunctionType
-  awaitAllAndExecuteFunctionType(MLIRContext *ctx, bool useLLVMOpaquePointers) {
-    auto hdl = opaquePointerType(ctx, useLLVMOpaquePointers);
-    Type resume;
-    if (useLLVMOpaquePointers)
-      resume = LLVM::LLVMPointerType::get(ctx);
-    else
-      resume = LLVM::LLVMPointerType::get(
-          resumeFunctionType(ctx, useLLVMOpaquePointers));
+  static FunctionType awaitAllAndExecuteFunctionType(MLIRContext *ctx) {
+    auto hdl = opaquePointerType(ctx);
+    Type resume = AsyncAPI::opaquePointerType(ctx);
     return FunctionType::get(ctx, {GroupType::get(ctx), hdl, resume}, {});
   }
 
@@ -230,17 +194,16 @@ struct AsyncAPI {
   }
 
   // Auxiliary coroutine resume intrinsic wrapper.
-  static Type resumeFunctionType(MLIRContext *ctx, bool useLLVMOpaquePointers) {
+  static Type resumeFunctionType(MLIRContext *ctx) {
     auto voidTy = LLVM::LLVMVoidType::get(ctx);
-    auto ptrType = opaquePointerType(ctx, useLLVMOpaquePointers);
+    auto ptrType = opaquePointerType(ctx);
     return LLVM::LLVMFunctionType::get(voidTy, {ptrType}, false);
   }
 };
 } // namespace
 
 /// Adds Async Runtime C API declarations to the module.
-static void addAsyncRuntimeApiDeclarations(ModuleOp module,
-                                           bool useLLVMOpaquePointers) {
+static void addAsyncRuntimeApiDeclarations(ModuleOp module) {
   auto builder =
       ImplicitLocOpBuilder::atBlockEnd(module.getLoc(), module.getBody());
 
@@ -251,39 +214,30 @@ static void addAsyncRuntimeApiDeclarations(ModuleOp module,
   };
 
   MLIRContext *ctx = module.getContext();
-  addFuncDecl(kAddRef,
-              AsyncAPI::addOrDropRefFunctionType(ctx, useLLVMOpaquePointers));
-  addFuncDecl(kDropRef,
-              AsyncAPI::addOrDropRefFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kAddRef, AsyncAPI::addOrDropRefFunctionType(ctx));
+  addFuncDecl(kDropRef, AsyncAPI::addOrDropRefFunctionType(ctx));
   addFuncDecl(kCreateToken, AsyncAPI::createTokenFunctionType(ctx));
-  addFuncDecl(kCreateValue,
-              AsyncAPI::createValueFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kCreateValue, AsyncAPI::createValueFunctionType(ctx));
   addFuncDecl(kCreateGroup, AsyncAPI::createGroupFunctionType(ctx));
   addFuncDecl(kEmplaceToken, AsyncAPI::emplaceTokenFunctionType(ctx));
-  addFuncDecl(kEmplaceValue,
-              AsyncAPI::emplaceValueFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kEmplaceValue, AsyncAPI::emplaceValueFunctionType(ctx));
   addFuncDecl(kSetTokenError, AsyncAPI::setTokenErrorFunctionType(ctx));
-  addFuncDecl(kSetValueError,
-              AsyncAPI::setValueErrorFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kSetValueError, AsyncAPI::setValueErrorFunctionType(ctx));
   addFuncDecl(kIsTokenError, AsyncAPI::isTokenErrorFunctionType(ctx));
-  addFuncDecl(kIsValueError,
-              AsyncAPI::isValueErrorFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kIsValueError, AsyncAPI::isValueErrorFunctionType(ctx));
   addFuncDecl(kIsGroupError, AsyncAPI::isGroupErrorFunctionType(ctx));
   addFuncDecl(kAwaitToken, AsyncAPI::awaitTokenFunctionType(ctx));
-  addFuncDecl(kAwaitValue,
-              AsyncAPI::awaitValueFunctionType(ctx, useLLVMOpaquePointers));
+  addFuncDecl(kAwaitValue, AsyncAPI::awaitValueFunctionType(ctx));
   addFuncDecl(kAwaitGroup, AsyncAPI::awaitGroupFunctionType(ctx));
-  addFuncDecl(kExecute,
-              AsyncAPI::executeFunctionType(ctx, useLLVMOpaquePointers));
-  addFuncDecl(kGetValueStorage, AsyncAPI::getValueStorageFunctionType(
-                                    ctx, useLLVMOpaquePointers));
+  addFuncDecl(kExecute, AsyncAPI::executeFunctionType(ctx));
+  addFuncDecl(kGetValueStorage, AsyncAPI::getValueStorageFunctionType(ctx));
   addFuncDecl(kAddTokenToGroup, AsyncAPI::addTokenToGroupFunctionType(ctx));
-  addFuncDecl(kAwaitTokenAndExecute, AsyncAPI::awaitTokenAndExecuteFunctionType(
-                                         ctx, useLLVMOpaquePointers));
-  addFuncDecl(kAwaitValueAndExecute, AsyncAPI::awaitValueAndExecuteFunctionType(
-                                         ctx, useLLVMOpaquePointers));
-  addFuncDecl(kAwaitAllAndExecute, AsyncAPI::awaitAllAndExecuteFunctionType(
-                                       ctx, useLLVMOpaquePointers));
+  addFuncDecl(kAwaitTokenAndExecute,
+              AsyncAPI::awaitTokenAndExecuteFunctionType(ctx));
+  addFuncDecl(kAwaitValueAndExecute,
+              AsyncAPI::awaitValueAndExecuteFunctionType(ctx));
+  addFuncDecl(kAwaitAllAndExecute,
+              AsyncAPI::awaitAllAndExecuteFunctionType(ctx));
   addFuncDecl(kGetNumWorkerThreads, AsyncAPI::getNumWorkerThreads(ctx));
 }
 
@@ -296,7 +250,7 @@ static constexpr const char *kResume = "__resume";
 /// A function that takes a coroutine handle and calls a `llvm.coro.resume`
 /// intrinsics. We need this function to be able to pass it to the async
 /// runtime execute API.
-static void addResumeFunction(ModuleOp module, bool useOpaquePointers) {
+static void addResumeFunction(ModuleOp module) {
   if (module.lookupSymbol(kResume))
     return;
 
@@ -305,11 +259,7 @@ static void addResumeFunction(ModuleOp module, bool useOpaquePointers) {
   auto moduleBuilder = ImplicitLocOpBuilder::atBlockEnd(loc, module.getBody());
 
   auto voidTy = LLVM::LLVMVoidType::get(ctx);
-  Type ptrType;
-  if (useOpaquePointers)
-    ptrType = LLVM::LLVMPointerType::get(ctx);
-  else
-    ptrType = LLVM::LLVMPointerType::get(IntegerType::get(ctx, 8));
+  Type ptrType = AsyncAPI::opaquePointerType(ctx);
 
   auto resumeOp = moduleBuilder.create<LLVM::LLVMFuncOp>(
       kResume, LLVM::LLVMFunctionType::get(voidTy, {ptrType}));
@@ -330,15 +280,10 @@ namespace {
 /// AsyncRuntimeTypeConverter only converts types from the Async dialect to
 /// their runtime type (opaque pointers) and does not convert any other types.
 class AsyncRuntimeTypeConverter : public TypeConverter {
-  bool llvmOpaquePointers = false;
-
 public:
-  AsyncRuntimeTypeConverter(const LowerToLLVMOptions &options)
-      : llvmOpaquePointers(options.useOpaquePointers) {
+  AsyncRuntimeTypeConverter(const LowerToLLVMOptions &options) {
     addConversion([](Type type) { return type; });
-    addConversion([this](Type type) {
-      return convertAsyncTypes(type, llvmOpaquePointers);
-    });
+    addConversion([](Type type) { return convertAsyncTypes(type); });
 
     // Use UnrealizedConversionCast as the bridge so that we don't need to pull
     // in patterns for other dialects.
@@ -352,28 +297,14 @@ class AsyncRuntimeTypeConverter : public TypeConverter {
     addTargetMaterialization(addUnrealizedCast);
   }
 
-  /// Returns whether LLVM opaque pointers should be used instead of typed
-  /// pointers.
-  bool useOpaquePointers() const { return llvmOpaquePointers; }
-
-  /// Creates an LLVM pointer type which may either be a typed pointer or an
-  /// opaque pointer, depending on what options the converter was constructed
-  /// with.
-  LLVM::LLVMPointerType getPointerType(Type elementType) const {
-    if (llvmOpaquePointers)
-      return LLVM::LLVMPointerType::get(elementType.getContext());
-    return LLVM::LLVMPointerType::get(elementType);
-  }
-
-  static std::optional<Type> convertAsyncTypes(Type type,
-                                               bool useOpaquePointers) {
+  static std::optional<Type> convertAsyncTypes(Type type) {
     if (isa<TokenType, GroupType, ValueType>(type))
-      return AsyncAPI::opaquePointerType(type.getContext(), useOpaquePointers);
+      return AsyncAPI::opaquePointerType(type.getContext());
 
     if (isa<CoroIdType, CoroStateType>(type))
       return AsyncAPI::tokenType(type.getContext());
     if (isa<CoroHandleType>(type))
-      return AsyncAPI::opaquePointerType(type.getContext(), useOpaquePointers);
+      return AsyncAPI::opaquePointerType(type.getContext());
 
     return std::nullopt;
   }
@@ -414,8 +345,7 @@ class CoroIdOpConversion : public AsyncOpConversionPattern<CoroIdOp> {
   matchAndRewrite(CoroIdOp op, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
     auto token = AsyncAPI::tokenType(op->getContext());
-    auto ptrType = AsyncAPI::opaquePointerType(
-        op->getContext(), getTypeConverter()->useOpaquePointers());
+    auto ptrType = AsyncAPI::opaquePointerType(op->getContext());
     auto loc = op->getLoc();
 
     // Constants for initializing coroutine frame.
@@ -444,8 +374,7 @@ class CoroBeginOpConversion : public AsyncOpConversionPattern<CoroBeginOp> {
   LogicalResult
   matchAndRewrite(CoroBeginOp op, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
-    auto ptrType = AsyncAPI::opaquePointerType(
-        op->getContext(), getTypeConverter()->useOpaquePointers());
+    auto ptrType = AsyncAPI::opaquePointerType(op->getContext());
     auto loc = op->getLoc();
 
     // Get coroutine frame size: @llvm.coro.size.i64.
@@ -472,8 +401,7 @@ class CoroBeginOpConversion : public AsyncOpConversionPattern<CoroBeginOp> {
 
     // Allocate memory for the coroutine frame.
     auto allocFuncOp = LLVM::lookupOrCreateAlignedAllocFn(
-        op->getParentOfType<ModuleOp>(), rewriter.getI64Type(),
-        getTypeConverter()->useOpaquePointers());
+        op->getParentOfType<ModuleOp>(), rewriter.getI64Type());
     auto coroAlloc = rewriter.create<LLVM::CallOp>(
         loc, allocFuncOp, ValueRange{coroAlign, coroSize});
 
@@ -499,8 +427,7 @@ class CoroFreeOpConversion : public AsyncOpConversionPattern<CoroFreeOp> {
   LogicalResult
   matchAndRewrite(CoroFreeOp op, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
-    auto ptrType = AsyncAPI::opaquePointerType(
-        op->getContext(), getTypeConverter()->useOpaquePointers());
+    auto ptrType = AsyncAPI::opaquePointerType(op->getContext());
     auto loc = op->getLoc();
 
     // Get a pointer to the coroutine frame memory: @llvm.coro.free.
@@ -509,8 +436,7 @@ class CoroFreeOpConversion : public AsyncOpConversionPattern<CoroFreeOp> {
 
     // Free the memory.
     auto freeFuncOp =
-        LLVM::lookupOrCreateFreeFn(op->getParentOfType<ModuleOp>(),
-                                   getTypeConverter()->useOpaquePointers());
+        LLVM::lookupOrCreateFreeFn(op->getParentOfType<ModuleOp>());
     rewriter.replaceOpWithNewOp<LLVM::CallOp>(op, freeFuncOp,
                                               ValueRange(coroMem.getResult()));
 
@@ -538,8 +464,9 @@ class CoroEndOpConversion : public OpConversionPattern<CoroEndOp> {
 
     // Mark the end of a coroutine: @llvm.coro.end.
     auto coroHdl = adaptor.getHandle();
-    rewriter.create<LLVM::CoroEndOp>(op->getLoc(), rewriter.getI1Type(),
-                                     ValueRange({coroHdl, constFalse, noneToken}));
+    rewriter.create<LLVM::CoroEndOp>(
+        op->getLoc(), rewriter.getI1Type(),
+        ValueRange({coroHdl, constFalse, noneToken}));
     rewriter.eraseOp(op);
 
     return success();
@@ -673,7 +600,8 @@ class RuntimeCreateOpLowering : public ConvertOpToLLVMPattern<RuntimeCreateOp> {
         auto i64 = rewriter.getI64Type();
 
         auto storedType = converter->convertType(valueType.getValueType());
-        auto storagePtrType = getTypeConverter()->getPointerType(storedType);
+        auto storagePtrType =
+            AsyncAPI::opaquePointerType(rewriter.getContext());
 
         // %Size = getelementptr %T* null, int 1
         // %SizeI = ptrtoint %T* %Size to i64
@@ -846,12 +774,10 @@ class RuntimeAwaitAndResumeOpLowering
     Value handle = adaptor.getHandle();
 
     // A pointer to coroutine resume intrinsic wrapper.
-    addResumeFunction(op->getParentOfType<ModuleOp>(),
-                      getTypeConverter()->useOpaquePointers());
-    auto resumeFnTy = AsyncAPI:...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/70731


More information about the Mlir-commits mailing list