[llvm] Removed redundant assert and condition in APInt::SetBits (PR #138038)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 30 14:47:40 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Liam Semeria (liamsemeria)
<details>
<summary>Changes</summary>
These changes were mentioned [here](https://github.com/llvm/llvm-project/pull/137098)
---
Full diff: https://github.com/llvm/llvm-project/pull/138038.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/APInt.h (+1-1)
``````````diff
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 02d58d8c3d31c..4a1205cedf605 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -1366,11 +1366,11 @@ class [[nodiscard]] APInt {
/// This function handles case when \p loBit <= \p hiBit.
void setBits(unsigned loBit, unsigned hiBit) {
assert(hiBit <= BitWidth && "hiBit out of range");
- assert(loBit <= BitWidth && "loBit out of range");
assert(loBit <= hiBit && "loBit greater than hiBit");
if (loBit == hiBit)
return;
if (loBit < APINT_BITS_PER_WORD && hiBit <= APINT_BITS_PER_WORD) {
+ //if (hiBit <= APINT_BITS_PER_WORD) {
uint64_t mask = WORDTYPE_MAX >> (APINT_BITS_PER_WORD - (hiBit - loBit));
mask <<= loBit;
if (isSingleWord())
``````````
</details>
https://github.com/llvm/llvm-project/pull/138038
More information about the llvm-commits
mailing list