[llvm-branch-commits] [mlir] [mlir][Transforms] Support 1:N mappings in `ConversionValueMapping` (PR #116524)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Nov 16 20:22:27 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff a496ab40c0a359d65fb2acfc2d862f0e4cf8b302 f027116e3d12422bcd2cc9a25dfd3ad09fc52196 --extensions cpp -- mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp mlir/lib/Dialect/EmitC/Transforms/TypeConversions.cpp mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp mlir/lib/Dialect/Quant/Transforms/StripFuncQuantTypes.cpp mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorDescriptor.cpp mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp mlir/lib/Transforms/Utils/DialectConversion.cpp mlir/test/lib/Dialect/Func/TestDecomposeCallGraphTypes.cpp mlir/test/lib/Dialect/Test/TestPatterns.cpp mlir/test/lib/Transforms/TestDialectConversion.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
index 7b60f8054c..1ab7b0d2fd 100644
--- a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
@@ -199,10 +199,10 @@ LLVMTypeConverter::LLVMTypeConverter(MLIRContext *ctx,
       BlockArgument barePtr = dyn_cast<BlockArgument>(inputs.front());
       if (!barePtr)
         return Value();
-      //Block *block = barePtr.getOwner();
-      //if (!block->isEntryBlock() ||
-      //    !isa<FunctionOpInterface>(block->getParentOp()))
-      //  return Value();
+      // Block *block = barePtr.getOwner();
+      // if (!block->isEntryBlock() ||
+      //     !isa<FunctionOpInterface>(block->getParentOp()))
+      //   return Value();
       desc = MemRefDescriptor::fromStaticShape(builder, loc, *this, resultType,
                                                inputs[0]);
     } else {
@@ -214,28 +214,30 @@ LLVMTypeConverter::LLVMTypeConverter(MLIRContext *ctx,
     return builder.create<UnrealizedConversionCastOp>(loc, resultType, desc)
         .getResult(0);
   });
-  addTargetMaterialization([&](OpBuilder &builder, LLVM::LLVMStructType resultType,
+  addTargetMaterialization([&](OpBuilder &builder,
+                               LLVM::LLVMStructType resultType,
                                ValueRange inputs, Location loc,
                                Type originalType) -> Value {
     if (auto memrefType = dyn_cast_or_null<MemRefType>(originalType)) {
       if (inputs.size() == 1) {
         Value input = inputs.front();
-        //if (auto castOp = input.getDefiningOp<UnrealizedConversionCastOp>()) {
-        //  if (castOp.getInputs().size() == 1 &&
-        //      isa<LLVM::LLVMPointerType>(castOp.getInputs()[0].getType())) {
-        //    input = castOp.getInputs()[0];
-        //  }
-        //}
+        // if (auto castOp = input.getDefiningOp<UnrealizedConversionCastOp>())
+        // {
+        //   if (castOp.getInputs().size() == 1 &&
+        //       isa<LLVM::LLVMPointerType>(castOp.getInputs()[0].getType())) {
+        //     input = castOp.getInputs()[0];
+        //   }
+        // }
         if (!isa<LLVM::LLVMPointerType>(input.getType()))
           return Value();
         BlockArgument barePtr = dyn_cast<BlockArgument>(input);
         if (!barePtr)
           return Value();
-        //Block *block = barePtr.getOwner();
-        //if (!block->isEntryBlock() ||
-        //    !isa<FunctionOpInterface>(block->getParentOp()))
-        //  return Value();
-        // Bare ptr
+        // Block *block = barePtr.getOwner();
+        // if (!block->isEntryBlock() ||
+        //     !isa<FunctionOpInterface>(block->getParentOp()))
+        //   return Value();
+        //  Bare ptr
         return MemRefDescriptor::fromStaticShape(builder, loc, *this,
                                                  memrefType, input);
       }

``````````

</details>


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


More information about the llvm-branch-commits mailing list