Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bolt/lib/Passes/PAuthGadgetScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ class SrcSafetyAnalysis {

// Being trusted is a strictly stronger property than being
// safe-to-dereference.
assert(!Next.TrustedRegs.test(Next.SafeToDerefRegs) &&
assert(Next.TrustedRegs.subsetOf(Next.SafeToDerefRegs) &&
"SafeToDerefRegs should contain all TrustedRegs");

return Next;
Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/ADT/BitVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class BitVector {
return *this;
}

/// test - Check if (This - RHS) is zero.
/// test - Check if (This - RHS) is non-zero.
/// This is the same as reset(RHS) and any().
bool test(const BitVector &RHS) const {
unsigned ThisWords = Bits.size();
Expand All @@ -567,6 +567,9 @@ class BitVector {
return false;
}

/// subsetOf - Check if This is a subset of RHS.
bool subsetOf(const BitVector &RHS) const { return !test(RHS); }

template <class F, class... ArgTys>
static BitVector &apply(F &&f, BitVector &Out, BitVector const &Arg,
ArgTys const &...Args) {
Expand Down
6 changes: 5 additions & 1 deletion llvm/include/llvm/ADT/SmallBitVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ class SmallBitVector {
return *this;
}

/// Check if (This - RHS) is zero. This is the same as reset(RHS) and any().
/// Check if (This - RHS) is non-zero.
/// This is the same as reset(RHS) and any().
bool test(const SmallBitVector &RHS) const {
if (isSmall() && RHS.isSmall())
return (getSmallBits() & ~RHS.getSmallBits()) != 0;
Expand All @@ -571,6 +572,9 @@ class SmallBitVector {
return false;
}

/// Check if This is a subset of RHS.
bool subsetOf(const SmallBitVector &RHS) const { return !test(RHS); }

SmallBitVector &operator|=(const SmallBitVector &RHS) {
resize(std::max(size(), RHS.size()));
if (isSmall() && RHS.isSmall())
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/StackLifetime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void StackLifetime::calculateLocalLiveness() {
BitsIn.resize(NumAllocas, true);

// Update block LiveIn set, noting whether it has changed.
if (BitsIn.test(BlockInfo.LiveIn)) {
if (!BitsIn.subsetOf(BlockInfo.LiveIn)) {
BlockInfo.LiveIn |= BitsIn;
}

Expand All @@ -198,7 +198,7 @@ void StackLifetime::calculateLocalLiveness() {
}

// Update block LiveOut set, noting whether it has changed.
if (BitsIn.test(BlockInfo.LiveOut)) {
if (!BitsIn.subsetOf(BlockInfo.LiveOut)) {
Changed = true;
BlockInfo.LiveOut |= BitsIn;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ bool DwarfExpression::addMachineReg(const TargetRegisterInfo &TRI,

// If this sub-register has a DWARF number and we haven't covered
// its range, and its range covers the value, emit a DWARF piece for it.
if (Offset < MaxSize && CurSubReg.test(Coverage)) {
if (Offset < MaxSize && !CurSubReg.subsetOf(Coverage)) {
// Emit a piece for any gap in the coverage.
if (Offset > CurPos)
DwarfRegs.push_back(Register::createSubRegister(
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/StackColoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,13 +815,13 @@ void StackColoring::calculateLocalLiveness() {
LocalLiveOut |= BlockInfo.Begin;

// Update block LiveIn set, noting whether it has changed.
if (LocalLiveIn.test(BlockInfo.LiveIn)) {
if (!LocalLiveIn.subsetOf(BlockInfo.LiveIn)) {
changed = true;
BlockInfo.LiveIn |= LocalLiveIn;
}

// Update block LiveOut set, noting whether it has changed.
if (LocalLiveOut.test(BlockInfo.LiveOut)) {
if (!LocalLiveOut.subsetOf(BlockInfo.LiveOut)) {
changed = true;
BlockInfo.LiveOut |= LocalLiveOut;
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ namespace {
return !Bits.any();
}
bool includes(const RegisterSet &Rs) const {
// A.test(B) <=> A-B != {}
return !Rs.Bits.test(Bits);
return Rs.Bits.subsetOf(Bits);
}
bool intersects(const RegisterSet &Rs) const {
return Bits.anyCommon(Rs.Bits);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonGenInsert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ namespace {
return !BitVector::any();
}
bool includes(const RegisterSet &Rs) const {
// A.BitVector::test(B) <=> A-B != {}
return !Rs.BitVector::test(*this);
return Rs.BitVector::subsetOf(*this);
}
bool intersects(const RegisterSet &Rs) const {
return BitVector::anyCommon(Rs);
Expand Down
Loading