[Mlir-commits] [mlir] 7313c3b - [mlir] Use llvm::bit_width (NFC) (#138648)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 7 16:16:20 PDT 2025
Author: Kazu Hirata
Date: 2025-05-07T16:16:16-07:00
New Revision: 7313c3b1f1454b408d9f845a1c6aa40c5b36cae9
URL: https://github.com/llvm/llvm-project/commit/7313c3b1f1454b408d9f845a1c6aa40c5b36cae9
DIFF: https://github.com/llvm/llvm-project/commit/7313c3b1f1454b408d9f845a1c6aa40c5b36cae9.diff
LOG: [mlir] Use llvm::bit_width (NFC) (#138648)
Note that bit_width is implemented as:
std::numeric_limits<T>::digits - llvm::countl_zero(Value);
Added:
Modified:
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h
index fca2629d72efc..d0a3f01afe871 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h
@@ -122,7 +122,7 @@ class I64BitSet {
unsigned m = llvm::countr_zero(storage);
return m == 64 ? -1 : m;
}
- unsigned max() const { return 64 - llvm::countl_zero(storage); }
+ unsigned max() const { return llvm::bit_width(storage); }
unsigned count() const { return llvm::popcount(storage); }
bool empty() const { return storage == 0; }
};
More information about the Mlir-commits
mailing list