Fix a few GCC compiler warnings (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Tue, 19 Jan 2021 05:59:15 +0000 (05:59 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 19 Jan 2021 06:00:04 +0000 (06:00 +0000)
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

index 3e45c41..da6fd48 100644 (file)
@@ -11,4 +11,4 @@
 #include "mlir/Dialect/Linalg/IR/LinalgOps.h"
 
 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Linalg, linalg,
-                                      mlir::linalg::LinalgDialect);
+                                      mlir::linalg::LinalgDialect)
index f81b010..c1dca6d 100644 (file)
@@ -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)
index 22e20ad..1f8e83a 100644 (file)
@@ -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)
index b611cb8..57083a8 100644 (file)
@@ -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)
index 8f336c0..266efc2 100644 (file)
@@ -11,4 +11,4 @@
 #include "mlir/CAPI/Registration.h"
 
 MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Tensor, tensor,
-                                      mlir::tensor::TensorDialect);
+                                      mlir::tensor::TensorDialect)
index 84c71e8..898b152 100644 (file)
@@ -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.
index 0d16022..376b989 100644 (file)
@@ -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);
       }
index 451be30..11a9db7 100644 (file)
@@ -810,6 +810,7 @@ private:
     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() {
index f07468a..ca50453 100644 (file)
@@ -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;
   }
index 64afc74..16bf6d1 100644 (file)
@@ -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.