Skip to content

Commit

Permalink
[BOLT][NFC] Remove uses of std::vector<bool>
Browse files Browse the repository at this point in the history
Summary:
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>`
and suggests `llvm::BitVector` as a possible replacement.
  • Loading branch information
aaupov committed Jan 14, 2022
1 parent dc9f18d commit 18bc405
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bolt/include/bolt/Passes/ReorderUtils.h
Expand Up @@ -142,7 +142,7 @@ class ClusterPairCacheThreadSafe {
private:
size_t Size;
std::vector<ValueType> Cache;
std::vector<bool> Valid;
BitVector Valid;

size_t index(const Cluster *First, const Cluster *Second) const {
return (First->id() * Size) + Second->id();
Expand Down
2 changes: 1 addition & 1 deletion bolt/include/bolt/Passes/ShrinkWrapping.h
Expand Up @@ -295,7 +295,7 @@ class ShrinkWrapping {
/// of moving this Callee-Saved Reg
DenseMap<unsigned, std::vector<uint32_t>> DeletedPushCFIs;
DenseMap<unsigned, std::vector<uint32_t>> DeletedPopCFIs;
std::vector<bool> HasDeletedOffsetCFIs;
BitVector HasDeletedOffsetCFIs;
SmallPtrSet<const MCCFIInstruction *, 16> UpdatedCFIs;
std::vector<BitVector> UsesByReg;
std::vector<int64_t> PushOffsetByReg;
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Passes/ReorderAlgorithm.cpp
Expand Up @@ -477,7 +477,7 @@ void TSPReorderAlgorithm::reorderBasicBlocks(const BinaryFunction &BF,
// Define final function layout based on layout that maximizes weight
uint64_t Last = BestLast;
uint64_t Set = BestSet;
std::vector<bool> Visited;
BitVector Visited;
Visited.resize(N);
Visited[Last] = true;
Order.push_back(IndexToBB[Last]);
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Passes/ShrinkWrapping.cpp
Expand Up @@ -1951,7 +1951,7 @@ void ShrinkWrapping::rebuildCFI() {
}

bool ShrinkWrapping::perform() {
HasDeletedOffsetCFIs = std::vector<bool>(BC.MRI->getNumRegs(), false);
HasDeletedOffsetCFIs = BitVector(BC.MRI->getNumRegs(), false);
PushOffsetByReg = std::vector<int64_t>(BC.MRI->getNumRegs(), 0LL);
PopOffsetByReg = std::vector<int64_t>(BC.MRI->getNumRegs(), 0LL);
DomOrder = std::vector<MCPhysReg>(BC.MRI->getNumRegs(), 0);
Expand Down

0 comments on commit 18bc405

Please sign in to comment.