[Mlir-commits] [mlir] 75076f8 - [mlir] Fix warnings

Kazu Hirata llvmlistbot at llvm.org
Sat Oct 15 12:40:19 PDT 2022


Author: Kazu Hirata
Date: 2022-10-15T12:40:02-07:00
New Revision: 75076f8dd75361244e1861fd7b85e18710e4026c

URL: https://github.com/llvm/llvm-project/commit/75076f8dd75361244e1861fd7b85e18710e4026c
DIFF: https://github.com/llvm/llvm-project/commit/75076f8dd75361244e1861fd7b85e18710e4026c.diff

LOG: [mlir] Fix warnings

This patch fixes:

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:171:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

  mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp:283:30:
  warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Added: 
    

Modified: 
    mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index abffadffb2251..6413d50948962 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -167,8 +167,8 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
 
 static Value floatCst(ImplicitLocOpBuilder &builder, float value,
                       Type elementType) {
-  assert(elementType.isF16() ||
-         elementType.isF32() && "x must be f16 or f32 type.");
+  assert((elementType.isF16() || elementType.isF32()) &&
+         "x must be f16 or f32 type.");
   return builder.create<arith::ConstantOp>(
       builder.getFloatAttr(elementType, value));
 }
@@ -279,8 +279,8 @@ namespace {
 Value makePolynomialCalculation(ImplicitLocOpBuilder &builder,
                                 llvm::ArrayRef<Value> coeffs, Value x) {
   Type elementType = getElementTypeOrSelf(x);
-  assert(elementType.isF32() ||
-         elementType.isF16() && "x must be f32 or f16 type");
+  assert((elementType.isF32() || elementType.isF16()) &&
+         "x must be f32 or f16 type");
   ArrayRef<int64_t> shape = vectorShape(x);
 
   if (coeffs.empty())


        


More information about the Mlir-commits mailing list