[llvm] 89c1c64 - [KnownBits] Merge const/non-const KnownBits::extractBits implementations. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 3 11:05:30 PDT 2021
Author: Simon Pilgrim
Date: 2021-07-03T19:00:25+01:00
New Revision: 89c1c64cc3170a05a881bb9954feafc3edca6704
URL: https://github.com/llvm/llvm-project/commit/89c1c64cc3170a05a881bb9954feafc3edca6704
DIFF: https://github.com/llvm/llvm-project/commit/89c1c64cc3170a05a881bb9954feafc3edca6704.diff
LOG: [KnownBits] Merge const/non-const KnownBits::extractBits implementations. NFC.
These are identical and can be just const.
Added:
Modified:
llvm/include/llvm/Support/KnownBits.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h
index 51a1df0505281..cfec5796493f3 100644
--- a/llvm/include/llvm/Support/KnownBits.h
+++ b/llvm/include/llvm/Support/KnownBits.h
@@ -204,8 +204,13 @@ struct KnownBits {
/// tracking.
KnownBits sextInReg(unsigned SrcBitWidth) const;
- /// Return a KnownBits with the extracted bits
- /// [bitPosition,bitPosition+numBits).
+ /// Insert the bits from a smaller known bits starting at bitPosition.
+ void insertBits(const KnownBits &SubBits, unsigned BitPosition) {
+ Zero.insertBits(SubBits.Zero, BitPosition);
+ One.insertBits(SubBits.One, BitPosition);
+ }
+
+ /// Return a subset of the known bits from [bitPosition,bitPosition+numBits).
KnownBits extractBits(unsigned NumBits, unsigned BitPosition) const {
return KnownBits(Zero.extractBits(NumBits, BitPosition),
One.extractBits(NumBits, BitPosition));
@@ -370,18 +375,6 @@ struct KnownBits {
/// Determine if these known bits always give the same ICMP_SLE result.
static Optional<bool> sle(const KnownBits &LHS, const KnownBits &RHS);
- /// Insert the bits from a smaller known bits starting at bitPosition.
- void insertBits(const KnownBits &SubBits, unsigned BitPosition) {
- Zero.insertBits(SubBits.Zero, BitPosition);
- One.insertBits(SubBits.One, BitPosition);
- }
-
- /// Return a subset of the known bits from [bitPosition,bitPosition+numBits).
- KnownBits extractBits(unsigned NumBits, unsigned BitPosition) {
- return KnownBits(Zero.extractBits(NumBits, BitPosition),
- One.extractBits(NumBits, BitPosition));
- }
-
/// Update known bits based on ANDing with RHS.
KnownBits &operator&=(const KnownBits &RHS);
More information about the llvm-commits
mailing list