[Mlir-commits] [mlir] [mlir] Refactor LegalizeToF32 to specify extra supported float types and target type as arguments (PR #108815)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 16 13:25:51 PDT 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 9b237b4013e86741cf7d4fcd95a7bc70772d2286 7ffcdae7051f2c0fac88d06e48d27cfd2b215294 --extensions cpp,h -- mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp mlir/include/mlir/Dialect/Arith/Utils/Utils.h mlir/include/mlir/Dialect/Math/Transforms/Passes.h mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp mlir/lib/Dialect/Arith/Utils/Utils.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/include/mlir/Dialect/Arith/Utils/Utils.h b/mlir/include/mlir/Dialect/Arith/Utils/Utils.h
index 81da2d208d..d759299cbf 100644
--- a/mlir/include/mlir/Dialect/Arith/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Arith/Utils/Utils.h
@@ -130,7 +130,7 @@ namespace arith {
 Value createProduct(OpBuilder &builder, Location loc, ArrayRef<Value> values);
 Value createProduct(OpBuilder &builder, Location loc, ArrayRef<Value> values,
                     Type resultType);
-                    
+
 // Map strings to float types.
 std::optional<FloatType> parseFloatType(MLIRContext *ctx, StringRef name);
 
diff --git a/mlir/include/mlir/Dialect/Math/Transforms/Passes.h b/mlir/include/mlir/Dialect/Math/Transforms/Passes.h
index b6ee5bc93f..2974bb344a 100644
--- a/mlir/include/mlir/Dialect/Math/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Math/Transforms/Passes.h
@@ -56,12 +56,13 @@ void populateMathPolynomialApproximationPatterns(
 void populateUpliftToFMAPatterns(RewritePatternSet &patterns);
 
 namespace math {
-void populateExtendToSupportedTypesTypeConverter(TypeConverter &typeConverter, const SetVector<Type> &sourceTypes,
+void populateExtendToSupportedTypesTypeConverter(
+    TypeConverter &typeConverter, const SetVector<Type> &sourceTypes,
     Type targetType);
-void populateExtendToSupportedTypesConversionTarget(ConversionTarget &target,
-                                           TypeConverter &typeConverter);
+void populateExtendToSupportedTypesConversionTarget(
+    ConversionTarget &target, TypeConverter &typeConverter);
 void populateExtendToSupportedTypesPatterns(RewritePatternSet &patterns,
-                                   TypeConverter &typeConverter);
+                                            TypeConverter &typeConverter);
 } // namespace math
 } // namespace mlir
 
diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
index eb8f74270d..b51444e884 100644
--- a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
@@ -133,7 +133,8 @@ void EmulateUnsupportedFloatsPass::runOnOperation() {
   SmallVector<Type> sourceTypes;
   Type targetType;
 
-  std::optional<FloatType> maybeTargetType = arith::parseFloatType(ctx, targetTypeStr);
+  std::optional<FloatType> maybeTargetType =
+      arith::parseFloatType(ctx, targetTypeStr);
   if (!maybeTargetType) {
     emitError(UnknownLoc::get(ctx), "could not map target type '" +
                                         targetTypeStr +

``````````

</details>


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


More information about the Mlir-commits mailing list