[Mlir-commits] [mlir] db3013d - [mlir] Silence warnings when building with Clang ToT

Alexandre Ganea llvmlistbot at llvm.org
Tue Jul 5 17:34:01 PDT 2022


Author: Alexandre Ganea
Date: 2022-07-05T20:31:53-04:00
New Revision: db3013d684ddff31a7ee97b2ba499eac29ac8704

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

LOG: [mlir] Silence warnings when building with Clang ToT

Previously, these warnings were seen:

[6599/7564] Building native mlir-pdll...
[270/278] Building CXX object tools/mlir/lib/Tools/PDLL/CodeGen/CMakeFiles/obj.MLIRPDLLCodeGen.dir/CPPGen.cpp.obj
In file included from C:/git/llvm-project/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp:20:
C:/git/llvm-project/mlir/include\mlir/Tools/PDLL/ODS/Operation.h(202,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
  friend class Dialect;
               ^
               ::mlir::
1 warning generated.

[278/278] Linking CXX executable bin\mlir-pdll.exe
[6857/7564] Building CXX object tools/mlir/unittests/ExecutionEngine/CMakeFiles/MLIRExecutionEngineTests.dir/Invoke.cpp.obj
In file included from C:/git/llvm-project/mlir/unittests/ExecutionEngine/Invoke.cpp:20:
C:/git/llvm-project/mlir/include\mlir/ExecutionEngine/MemRefUtils.h(104,27): warning: shift count >= width of type [-Wshift-count-overflow]
  assert(sizeof(T) < (1ul << 32) && "Elemental type overflows");
                          ^  ~~
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt\assert.h(40,17): note: expanded from macro 'assert'
            (!!(expression)) ||                                                              \
                ^~~~~~~~~~
1 warning generated.

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/MemRefUtils.h
    mlir/include/mlir/Tools/PDLL/ODS/Operation.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
index 42f00795fe850..1231da565addb 100644
--- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
@@ -101,7 +101,7 @@ template <typename T>
 std::pair<T *, T *>
 allocAligned(size_t nElements, AllocFunType allocFun = &::malloc,
              llvm::Optional<uint64_t> alignment = llvm::Optional<uint64_t>()) {
-  assert(sizeof(T) < (1ul << 32) && "Elemental type overflows");
+  assert(sizeof(T) <= UINT_MAX && "Elemental type overflows");
   auto size = nElements * sizeof(T);
   auto desiredAlignment = alignment.value_or(nextPowerOf2(sizeof(T)));
   assert((desiredAlignment & (desiredAlignment - 1)) == 0);

diff  --git a/mlir/include/mlir/Tools/PDLL/ODS/Operation.h b/mlir/include/mlir/Tools/PDLL/ODS/Operation.h
index f4c5a518fbfa9..e49db88ef9c93 100644
--- a/mlir/include/mlir/Tools/PDLL/ODS/Operation.h
+++ b/mlir/include/mlir/Tools/PDLL/ODS/Operation.h
@@ -22,6 +22,7 @@ namespace pdll {
 namespace ods {
 class AttributeConstraint;
 class TypeConstraint;
+class Dialect;
 
 //===----------------------------------------------------------------------===//
 // VariableLengthKind


        


More information about the Mlir-commits mailing list