[Mlir-commits] [mlir] 7dadcd0 - Fix a few GCC compiler warnings (NFC)

Mehdi Amini llvmlistbot at llvm.org
Mon Jan 18 22:00:23 PST 2021


Author: Mehdi Amini
Date: 2021-01-19T06:00:04Z
New Revision: 7dadcd02d6ce0278723c87736f6278610da0ddb2

URL: https://github.com/llvm/llvm-project/commit/7dadcd02d6ce0278723c87736f6278610da0ddb2
DIFF: https://github.com/llvm/llvm-project/commit/7dadcd02d6ce0278723c87736f6278610da0ddb2.diff

LOG: Fix a few GCC compiler warnings (NFC)

Added: 
    

Modified: 
    mlir/lib/CAPI/Dialect/Linalg.cpp
    mlir/lib/CAPI/Dialect/SCF.cpp
    mlir/lib/CAPI/Dialect/Shape.cpp
    mlir/lib/CAPI/Dialect/Standard.cpp
    mlir/lib/CAPI/Dialect/Tensor.cpp
    mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
    mlir/lib/ExecutionEngine/SparseUtils.cpp
    mlir/lib/Rewrite/ByteCode.cpp
    mlir/tools/mlir-tblgen/OpFormatGen.cpp
    mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/CAPI/Dialect/Linalg.cpp b/mlir/lib/CAPI/Dialect/Linalg.cpp
index 3e45c41adc72..da6fd4846bd6 100644
--- a/mlir/lib/CAPI/Dialect/Linalg.cpp
+++ b/mlir/lib/CAPI/Dialect/Linalg.cpp
@@ -11,4 +11,4 @@
 #include "mlir/Dialect/Linalg/IR/LinalgOps.h"
 
 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Linalg, linalg,
-                                      mlir::linalg::LinalgDialect);
+                                      mlir::linalg::LinalgDialect)

diff  --git a/mlir/lib/CAPI/Dialect/SCF.cpp b/mlir/lib/CAPI/Dialect/SCF.cpp
index f81b010b04e2..c1dca6d2118f 100644
--- a/mlir/lib/CAPI/Dialect/SCF.cpp
+++ b/mlir/lib/CAPI/Dialect/SCF.cpp
@@ -10,4 +10,4 @@
 #include "mlir-c/Dialect/SCF.h"
 #include "mlir/CAPI/Registration.h"
 
-MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(SCF, scf, mlir::scf::SCFDialect);
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(SCF, scf, mlir::scf::SCFDialect)

diff  --git a/mlir/lib/CAPI/Dialect/Shape.cpp b/mlir/lib/CAPI/Dialect/Shape.cpp
index 22e20ad8eaaa..1f8e83a0c729 100644
--- a/mlir/lib/CAPI/Dialect/Shape.cpp
+++ b/mlir/lib/CAPI/Dialect/Shape.cpp
@@ -10,4 +10,4 @@
 #include "mlir-c/Dialect/Shape.h"
 #include "mlir/CAPI/Registration.h"
 
-MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Shape, shape, mlir::shape::ShapeDialect);
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Shape, shape, mlir::shape::ShapeDialect)

diff  --git a/mlir/lib/CAPI/Dialect/Standard.cpp b/mlir/lib/CAPI/Dialect/Standard.cpp
index b611cb85f6f6..57083a8a21a3 100644
--- a/mlir/lib/CAPI/Dialect/Standard.cpp
+++ b/mlir/lib/CAPI/Dialect/Standard.cpp
@@ -10,4 +10,4 @@
 #include "mlir/CAPI/Registration.h"
 #include "mlir/Dialect/StandardOps/IR/Ops.h"
 
-MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Standard, std, mlir::StandardOpsDialect);
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Standard, std, mlir::StandardOpsDialect)

diff  --git a/mlir/lib/CAPI/Dialect/Tensor.cpp b/mlir/lib/CAPI/Dialect/Tensor.cpp
index 8f336c0bf3c4..266efc26b6f9 100644
--- a/mlir/lib/CAPI/Dialect/Tensor.cpp
+++ b/mlir/lib/CAPI/Dialect/Tensor.cpp
@@ -11,4 +11,4 @@
 #include "mlir/CAPI/Registration.h"
 
 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Tensor, tensor,
-                                      mlir::tensor::TensorDialect);
+                                      mlir::tensor::TensorDialect)

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
index 84c71e84c42e..898b15266072 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
@@ -500,6 +500,7 @@ static unsigned buildLattices(Merger &merger, linalg::GenericOp op,
   case Kind::kAddI:
     return merger.takeDisj(kind, s0, s1);
   }
+  llvm_unreachable("unexpected expression kind");
 }
 
 /// Maps sparse integer option to actual integral storage type.
@@ -512,6 +513,7 @@ static Type genIntType(PatternRewriter &rewriter, linalg::SparseIntType tp) {
   case linalg::SparseIntType::kI32:
     return rewriter.getIntegerType(32);
   }
+  llvm_unreachable("unexpected SparseIntType");
 }
 
 /// Local bufferization of all dense and sparse data structures.
@@ -735,6 +737,7 @@ static Value genExp(Merger &merger, CodeGen &codegen, PatternRewriter &rewriter,
   case Kind::kAddI:
     return rewriter.create<AddIOp>(op.getLoc(), v0, v1);
   }
+  llvm_unreachable("unexpected expression kind");
 }
 
 /// Hoists loop invariant tensor loads for which indices have been exhausted.
@@ -825,6 +828,7 @@ static bool isVectorFor(CodeGen &codegen, bool isInner, bool isSparse) {
   case linalg::SparseVectorizationStrategy::kAnyStorageInnerLoop:
     return isInner;
   }
+  llvm_unreachable("unexpected vectorization strategy");
 }
 
 /// Returns parallelization strategy. Any implicit loop in the Linalg operation
@@ -844,6 +848,7 @@ static bool isParallelFor(CodeGen &codegen, bool isOuter, bool isReduction,
   case linalg::SparseParallelizationStrategy::kAnyStorageAnyLoop:
     return !isReduction && !isVector;
   }
+  llvm_unreachable("unexpected parallelization strategy");
 }
 
 /// Generates a for-loop on a single index.

diff  --git a/mlir/lib/ExecutionEngine/SparseUtils.cpp b/mlir/lib/ExecutionEngine/SparseUtils.cpp
index 0d160220639f..376b989975b5 100644
--- a/mlir/lib/ExecutionEngine/SparseUtils.cpp
+++ b/mlir/lib/ExecutionEngine/SparseUtils.cpp
@@ -233,7 +233,7 @@ extern "C" void *openTensorC(char *filename, uint64_t *idata) {
   double value;
   for (uint64_t k = 0; k < nnz; k++) {
     for (uint64_t r = 0; r < rank; r++) {
-      if (fscanf(file, "%" PRIu64, &indices[r]) != 1) {
+      if (fscanf(file, "%" PRId64, &indices[r]) != 1) {
         fprintf(stderr, "Cannot find next index in %s\n", filename);
         exit(1);
       }

diff  --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp
index 451be3036767..11a9db79b322 100644
--- a/mlir/lib/Rewrite/ByteCode.cpp
+++ b/mlir/lib/Rewrite/ByteCode.cpp
@@ -810,6 +810,7 @@ class ByteCodeExecutor {
     case PDLValueKind::Value:
       return read<Value>();
     }
+    llvm_unreachable("unhandled PDLValueKind");
   }
   template <typename T>
   std::enable_if_t<std::is_same<T, ByteCodeAddr>::value, T> readImpl() {

diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index f07468a7049f..ca504530cffa 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1757,7 +1757,7 @@ void OperationFormat::genElementPrinter(Element *element, OpMethodBody &body,
                              lastWasPunctuation);
 
   // Emit a whitespace element.
-  if (NewlineElement *newline = dyn_cast<NewlineElement>(element)) {
+  if (isa<NewlineElement>(element)) {
     body << "  p.printNewline();\n";
     return;
   }

diff  --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
index 64afc747351a..16bf6d1dc03f 100644
--- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
@@ -244,7 +244,7 @@ static bool isPythonKeyword(StringRef str) {
        "is",    "lambda", "nonlocal", "not",   "or",     "pass",
        "raise", "return", "try",      "while", "with",   "yield"});
   return keywords.contains(str);
-};
+}
 
 /// Checks whether `str` would shadow a generated variable or attribute
 /// part of the OpView API.


        


More information about the Mlir-commits mailing list