[llvm] 3ffde4a - [APInt] Removed redundant assert and condition in APInt::SetBits (#138038)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 05:24:45 PDT 2025
Author: Liam Semeria
Date: 2025-05-12T13:24:41+01:00
New Revision: 3ffde4a1acd90fe3b2a7fd89bb794c1c36728d84
URL: https://github.com/llvm/llvm-project/commit/3ffde4a1acd90fe3b2a7fd89bb794c1c36728d84
DIFF: https://github.com/llvm/llvm-project/commit/3ffde4a1acd90fe3b2a7fd89bb794c1c36728d84.diff
LOG: [APInt] Removed redundant assert and condition in APInt::SetBits (#138038)
During [pull request](https://github.com/llvm/llvm-project/pull/137098) it was suggested that I remove these redundant parts of APInt::SetBits.
Added:
Modified:
llvm/include/llvm/ADT/APInt.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index ba33c49fb5191..7fbf09b44e6c4 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -1366,11 +1366,10 @@ 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())
More information about the llvm-commits
mailing list