Skip to content

Commit

Permalink
[MachineSink] Use LLVM ADTs (NFC) (#68677)
Browse files Browse the repository at this point in the history
Replace a few uses of `std::map` with `llvm::DenseMap`.
  • Loading branch information
momchil-velikov committed Oct 12, 2023
1 parent 7a18b3c commit 86d9faa
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions llvm/lib/CodeGen/MachineSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <map>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -139,7 +138,7 @@ namespace {
DenseSet<Register> RegsToClearKillFlags;

using AllSuccsCache =
std::map<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;
DenseMap<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;

/// DBG_VALUE pointer and flag. The flag is true if this DBG_VALUE is
/// post-dominated by another DBG_VALUE of the same variable location.
Expand All @@ -160,14 +159,15 @@ namespace {
/// current block.
DenseSet<DebugVariable> SeenDbgVars;

std::map<std::pair<MachineBasicBlock *, MachineBasicBlock *>, bool>
DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>, bool>
HasStoreCache;
std::map<std::pair<MachineBasicBlock *, MachineBasicBlock *>,
std::vector<MachineInstr *>>

DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>,
SmallVector<MachineInstr *>>
StoreInstrCache;

/// Cached BB's register pressure.
std::map<const MachineBasicBlock *, std::vector<unsigned>>
DenseMap<const MachineBasicBlock *, std::vector<unsigned>>
CachedRegisterPressure;

bool EnableSinkAndFold;
Expand Down Expand Up @@ -1429,11 +1429,11 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From,

// Does these two blocks pair be queried before and have a definite cached
// result?
if (HasStoreCache.find(BlockPair) != HasStoreCache.end())
return HasStoreCache[BlockPair];
if (auto It = HasStoreCache.find(BlockPair); It != HasStoreCache.end())
return It->second;

if (StoreInstrCache.find(BlockPair) != StoreInstrCache.end())
return llvm::any_of(StoreInstrCache[BlockPair], [&](MachineInstr *I) {
if (auto It = StoreInstrCache.find(BlockPair); It != StoreInstrCache.end())
return llvm::any_of(It->second, [&](MachineInstr *I) {
return I->mayAlias(AA, MI, false);
});

Expand Down

0 comments on commit 86d9faa

Please sign in to comment.