Skip to content

Commit 4aeefff

Browse files
authored
[KnownBits] Mark constructor for KnownBits as explicit (llvm#190253)
To avoid confusion between constant values and bit widths.
1 parent c1f2955 commit 4aeefff

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/include/llvm/CodeGen/FunctionLoweringInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class FunctionLoweringInfo {
162162
struct LiveOutInfo {
163163
unsigned NumSignBits : 31;
164164
unsigned IsValid : 1;
165-
KnownBits Known = 1;
165+
KnownBits Known;
166166

167-
LiveOutInfo() : NumSignBits(0), IsValid(true) {}
167+
LiveOutInfo() : NumSignBits(0), IsValid(true), Known(1) {}
168168
};
169169

170170
/// Record the preferred extend type (ISD::SIGN_EXTEND or ISD::ZERO_EXTEND)

llvm/include/llvm/Support/KnownBits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct KnownBits {
3838
KnownBits() = default;
3939

4040
/// Create a known bits object of BitWidth bits initialized to unknown.
41-
KnownBits(unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {}
41+
explicit KnownBits(unsigned BitWidth) : Zero(BitWidth, 0), One(BitWidth, 0) {}
4242

4343
/// Get the bit width of this value.
4444
unsigned getBitWidth() const {

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7673,7 +7673,7 @@ static void computeKnownBitsForPRMT(const SDValue Op, KnownBits &Known,
76737673
unsigned Sign = Sel.getHiBits(1).getZExtValue();
76747674
KnownBits Byte = BitField.extractBits(8, Idx * 8);
76757675
if (Sign)
7676-
Byte = KnownBits::ashr(Byte, 8);
7676+
Byte = KnownBits::ashr(Byte, KnownBits::makeConstant(APInt(8, 7)));
76777677
Known.insertBits(Byte, I * 8);
76787678
}
76797679
}

0 commit comments

Comments
 (0)