[Mlir-commits] [mlir] [mlir][vector] Fix mask neutral value for masked fmaximum/fminimum reductions (PR #222275)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 9 02:15:44 PDT 2026


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 origin/main HEAD --extensions cpp -- mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index be4fdeb9e..53f28d5ff 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -593,9 +593,9 @@ static Value createReductionNeutralValue(ReductionNeutralFPNegInf neutral,
   auto floatType = cast<FloatType>(llvmType);
   return LLVM::ConstantOp::create(
       rewriter, loc, llvmType,
-      rewriter.getFloatAttr(
-          llvmType, llvm::APFloat::getInf(floatType.getFloatSemantics(),
-                                          /*Negative=*/true)));
+      rewriter.getFloatAttr(llvmType,
+                            llvm::APFloat::getInf(floatType.getFloatSemantics(),
+                                                  /*Negative=*/true)));
 }
 
 /// Create the reduction neutral positive infinity value.
@@ -605,9 +605,9 @@ static Value createReductionNeutralValue(ReductionNeutralFPPosInf neutral,
   auto floatType = cast<FloatType>(llvmType);
   return LLVM::ConstantOp::create(
       rewriter, loc, llvmType,
-      rewriter.getFloatAttr(
-          llvmType, llvm::APFloat::getInf(floatType.getFloatSemantics(),
-                                          /*Negative=*/false)));
+      rewriter.getFloatAttr(llvmType,
+                            llvm::APFloat::getInf(floatType.getFloatSemantics(),
+                                                  /*Negative=*/false)));
 }
 
 /// Create the reduction neutral lowest finite value.
@@ -1047,12 +1047,13 @@ public:
       // `ninf` promises no infinity reaches the reduction, so the neutral start
       // value must stay finite.
       result =
-          noInfs ? lowerPredicatedReductionWithStartValue<
-                       LLVM::VPReduceFMaximumOp, ReductionNeutralFPLowestFinite>(
-                       rewriter, loc, llvmType, operand, acc, maskOp.getMask())
-                 : lowerPredicatedReductionWithStartValue<
-                       LLVM::VPReduceFMaximumOp, ReductionNeutralFPNegInf>(
-                       rewriter, loc, llvmType, operand, acc, maskOp.getMask());
+          noInfs
+              ? lowerPredicatedReductionWithStartValue<
+                    LLVM::VPReduceFMaximumOp, ReductionNeutralFPLowestFinite>(
+                    rewriter, loc, llvmType, operand, acc, maskOp.getMask())
+              : lowerPredicatedReductionWithStartValue<
+                    LLVM::VPReduceFMaximumOp, ReductionNeutralFPNegInf>(
+                    rewriter, loc, llvmType, operand, acc, maskOp.getMask());
       break;
     case CombiningKind::MINIMUMF:
       result =

``````````

</details>


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


More information about the Mlir-commits mailing list