Skip to content

Commit 864981d

Browse files
authored
[NFC][MachineLICM] Use SmallDenseSet instead of SmallSet (#95201)
All values are small so no reason to ever use SmallSet really. In large programs we'll end up using std::set which is extremely slow compared to DenseSet. This brings a decent speedup to the pass in large programs.
1 parent d32afb3 commit 864981d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ namespace {
155155
}
156156

157157
// Track 'estimated' register pressure.
158-
SmallSet<Register, 32> RegSeen;
158+
SmallDenseSet<Register> RegSeen;
159159
SmallVector<unsigned, 8> RegPressure;
160160

161161
// Register pressure "limit" per register pressure set. If the pressure
@@ -224,7 +224,7 @@ namespace {
224224
MachineBasicBlock *CurPreheader);
225225

226226
void ProcessMI(MachineInstr *MI, BitVector &RUDefs, BitVector &RUClobbers,
227-
SmallSet<int, 32> &StoredFIs,
227+
SmallDenseSet<int> &StoredFIs,
228228
SmallVectorImpl<CandidateInfo> &Candidates,
229229
MachineLoop *CurLoop);
230230

@@ -464,7 +464,7 @@ static void applyBitsNotInRegMaskToRegUnitsMask(const TargetRegisterInfo &TRI,
464464
/// gather register def and frame object update information.
465465
void MachineLICMBase::ProcessMI(MachineInstr *MI, BitVector &RUDefs,
466466
BitVector &RUClobbers,
467-
SmallSet<int, 32> &StoredFIs,
467+
SmallDenseSet<int> &StoredFIs,
468468
SmallVectorImpl<CandidateInfo> &Candidates,
469469
MachineLoop *CurLoop) {
470470
bool RuledOut = false;
@@ -568,7 +568,7 @@ void MachineLICMBase::HoistRegionPostRA(MachineLoop *CurLoop,
568568
BitVector RUClobbers(NumRegUnits); // RUs defined more than once.
569569

570570
SmallVector<CandidateInfo, 32> Candidates;
571-
SmallSet<int, 32> StoredFIs;
571+
SmallDenseSet<int> StoredFIs;
572572

573573
// Walk the entire region, count number of defs for each register, and
574574
// collect potential LICM candidates.

0 commit comments

Comments
 (0)