Skip to content

Commit c17af94

Browse files
committed
[ConstraintElim] Use SmallDenseMap (NFC)
The number of variables in the constraint is usually very small. Use SmallDenseMap to avoid allocations.
1 parent 55d5ba9 commit c17af94

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
644644

645645
// First try to look up \p V in Value2Index and NewVariables. Otherwise add a
646646
// new entry to NewVariables.
647-
DenseMap<Value *, unsigned> NewIndexMap;
647+
SmallDenseMap<Value *, unsigned> NewIndexMap;
648648
auto GetOrAddIndex = [&Value2Index, &NewVariables,
649649
&NewIndexMap](Value *V) -> unsigned {
650650
auto V2I = Value2Index.find(V);
@@ -668,7 +668,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
668668
IsSigned, IsEq, IsNe);
669669
// Collect variables that are known to be positive in all uses in the
670670
// constraint.
671-
DenseMap<Value *, bool> KnownNonNegativeVariables;
671+
SmallDenseMap<Value *, bool> KnownNonNegativeVariables;
672672
auto &R = Res.Coefficients;
673673
for (const auto &KV : VariablesA) {
674674
R[GetOrAddIndex(KV.Variable)] += KV.Coefficient;

0 commit comments

Comments
 (0)