[Mlir-commits] [mlir] 341a51a - [mlir] Fix shift overflow and warning on LLP64 platforms (Windows) (#74002)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Dec 6 09:26:04 PST 2023


Author: Reid Kleckner
Date: 2023-12-06T09:26:00-08:00
New Revision: 341a51aac4b344c96d9d8774cf97a57cad76a9f4

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

LOG: [mlir] Fix shift overflow and warning on LLP64 platforms (Windows) (#74002)

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
index 9af42f00f91ed..ac91bfa5ae622 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/Enums.h
@@ -531,11 +531,11 @@ static_assert((isUniqueLT(LevelType::Dense) &&
 constexpr uint64_t encodeDim(uint64_t i, uint64_t cf, uint64_t cm) {
   if (cf != 0) {
     assert(cf <= 0xfffff && cm == 0 && i <= 0xfffff);
-    return (0x01L << 60) | (cf << 20) | i;
+    return (0x01ULL << 60) | (cf << 20) | i;
   }
   if (cm != 0) {
     assert(cm <= 0xfffff && i <= 0xfffff);
-    return (0x02L << 60) | (cm << 20) | i;
+    return (0x02ULL << 60) | (cm << 20) | i;
   }
   assert(i <= 0x0fffffffffffffffu);
   return i;
@@ -543,7 +543,7 @@ constexpr uint64_t encodeDim(uint64_t i, uint64_t cf, uint64_t cm) {
 constexpr uint64_t encodeLvl(uint64_t i, uint64_t c, uint64_t ii) {
   if (c != 0) {
     assert(c <= 0xfffff && ii <= 0xfffff && i <= 0xfffff);
-    return (0x03L << 60) | (c << 20) | (ii << 40) | i;
+    return (0x03ULL << 60) | (c << 20) | (ii << 40) | i;
   }
   assert(i <= 0x0fffffffffffffffu);
   return i;


        


More information about the Mlir-commits mailing list