[llvm] c17af94 - [ConstraintElim] Use SmallDenseMap (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 08:04:13 PST 2024
Author: Nikita Popov
Date: 2024-01-03T17:04:04+01:00
New Revision: c17af94b9619997ce7c060ff112988e0ec218c10
URL: https://github.com/llvm/llvm-project/commit/c17af94b9619997ce7c060ff112988e0ec218c10
DIFF: https://github.com/llvm/llvm-project/commit/c17af94b9619997ce7c060ff112988e0ec218c10.diff
LOG: [ConstraintElim] Use SmallDenseMap (NFC)
The number of variables in the constraint is usually very small.
Use SmallDenseMap to avoid allocations.
Added:
Modified:
llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 06c87bd6dc374a..cc93c8617c05e2 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -644,7 +644,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
// First try to look up \p V in Value2Index and NewVariables. Otherwise add a
// new entry to NewVariables.
- DenseMap<Value *, unsigned> NewIndexMap;
+ SmallDenseMap<Value *, unsigned> NewIndexMap;
auto GetOrAddIndex = [&Value2Index, &NewVariables,
&NewIndexMap](Value *V) -> unsigned {
auto V2I = Value2Index.find(V);
@@ -668,7 +668,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
IsSigned, IsEq, IsNe);
// Collect variables that are known to be positive in all uses in the
// constraint.
- DenseMap<Value *, bool> KnownNonNegativeVariables;
+ SmallDenseMap<Value *, bool> KnownNonNegativeVariables;
auto &R = Res.Coefficients;
for (const auto &KV : VariablesA) {
R[GetOrAddIndex(KV.Variable)] += KV.Coefficient;
More information about the llvm-commits
mailing list