[Mlir-commits] [mlir] 42f5b05 - [mlir][NFC] Fix various warnings generated by GCC 9

Daniil Dudkin llvmlistbot at llvm.org
Mon Jul 4 03:23:29 PDT 2022


Author: Daniil Dudkin
Date: 2022-07-04T13:22:33+03:00
New Revision: 42f5b0509ded45cf4838c1e308680963428496b8

URL: https://github.com/llvm/llvm-project/commit/42f5b0509ded45cf4838c1e308680963428496b8
DIFF: https://github.com/llvm/llvm-project/commit/42f5b0509ded45cf4838c1e308680963428496b8.diff

LOG: [mlir][NFC] Fix various warnings generated by GCC 9

Currently, there've been a lot of warnings while building MLIR.
This change fixes the warnings listed below.

  .../SparseTensorUtils.cpp: In instantiation of ‘...::openSparseTensorCOO(...) [with ...]’:
  .../SparseTensorUtils.cpp:1672:3:   required from here
  .../SparseTensorUtils.cpp:87:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘PrimaryType’ [-Wformat=]

  .../OptUtils.cpp:36:5: warning: this statement may fall through [-Wimplicit-fallthrough=]

  .../AffineOps.cpp:1741:32: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Reviewed By: aartbik, wrengr, aeubanks

Differential Revision: https://reviews.llvm.org/D128993

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    mlir/lib/ExecutionEngine/OptUtils.cpp
    mlir/lib/ExecutionEngine/SparseTensorUtils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index a144939d44434..9986a9235101c 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -1738,7 +1738,7 @@ void AffineForOp::getCanonicalizationPatterns(RewritePatternSet &results,
 /// induction variable. AffineForOp only has one region, so zero is the only
 /// valid value for `index`.
 OperandRange AffineForOp::getSuccessorEntryOperands(Optional<unsigned> index) {
-  assert(!index || *index == 0 && "invalid region index");
+  assert((!index || *index == 0) && "invalid region index");
 
   // The initial operands map to the loop arguments after the induction
   // variable or are forwarded to the results when the trip count is zero.

diff  --git a/mlir/lib/ExecutionEngine/OptUtils.cpp b/mlir/lib/ExecutionEngine/OptUtils.cpp
index 33b52aadf9c48..403e54f004e2b 100644
--- a/mlir/lib/ExecutionEngine/OptUtils.cpp
+++ b/mlir/lib/ExecutionEngine/OptUtils.cpp
@@ -43,7 +43,7 @@ static Optional<OptimizationLevel> mapToLevel(unsigned optLevel,
     case 2:
       return OptimizationLevel::Oz;
     }
-
+    break;
   case 3:
     return OptimizationLevel::O3;
   }

diff  --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
index b69bec2d5cc4b..5a47acedcfee2 100644
--- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
@@ -1366,7 +1366,7 @@ openSparseTensorCOO(char *filename, uint64_t rank, const uint64_t *shape,
   if ((valueKind == SparseTensorFile::ValueKind::kReal && tensorIsInteger) ||
       (valueKind == SparseTensorFile::ValueKind::kComplex && tensorIsReal)) {
     FATAL("Tensor element type %d not compatible with values in file %s\n",
-          valTp, filename);
+          static_cast<int>(valTp), filename);
   }
   stfile.assertMatchesShape(rank, shape);
   // Prepare sparse tensor object with per-dimension sizes


        


More information about the Mlir-commits mailing list