From: Eugene Zhulenev Date: Fri, 26 Aug 2022 22:38:41 +0000 (-0700) Subject: [mlir] Async: add unrealized cast materializations to AsyncToLLVM pass X-Git-Tag: upstream/17.0.6~34936 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2a8a3af5e64a6dcfbe463311091d9e6b4d9c102;p=platform%2Fupstream%2Fllvm.git [mlir] Async: add unrealized cast materializations to AsyncToLLVM pass [mlir] Async: add unrealized cast materializations to AsyncToLLVM pass Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D132768 --- diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp index aa6598c..26154e4 100644 --- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp +++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp @@ -278,6 +278,17 @@ public: AsyncRuntimeTypeConverter() { addConversion([](Type type) { return type; }); addConversion(convertAsyncTypes); + + // Use UnrealizedConversionCast as the bridge so that we don't need to pull + // in patterns for other dialects. + auto addUnrealizedCast = [](OpBuilder &builder, Type type, + ValueRange inputs, Location loc) { + auto cast = builder.create(loc, type, inputs); + return Optional(cast.getResult(0)); + }; + + addSourceMaterialization(addUnrealizedCast); + addTargetMaterialization(addUnrealizedCast); } static Optional convertAsyncTypes(Type type) {