[Mlir-commits] [mlir] [mlir] Use llvm::bit_width (NFC) (PR #138648)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue May 6 00:26:30 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that bit_width is implemented as:
std::numeric_limits<T>::digits - llvm::countl_zero(Value);
---
Full diff: https://github.com/llvm/llvm-project/pull/138648.diff
1 Files Affected:
- (modified) mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensor.h (+1-1)
``````````diff
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; }
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/138648
More information about the Mlir-commits
mailing list