Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[LVI] Use SmallDenseMap for getValueFromCondition(); NFC
For the common case, we will only insert one value into this map.
  • Loading branch information
nikic committed Mar 22, 2020
1 parent 71f8b78 commit dbf78ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/Analysis/LazyValueInfo.cpp
Expand Up @@ -1278,11 +1278,11 @@ static ValueLatticeElement getValueFromOverflowCondition(

static ValueLatticeElement
getValueFromCondition(Value *Val, Value *Cond, bool isTrueDest,
DenseMap<Value*, ValueLatticeElement> &Visited);
SmallDenseMap<Value*, ValueLatticeElement> &Visited);

static ValueLatticeElement
getValueFromConditionImpl(Value *Val, Value *Cond, bool isTrueDest,
DenseMap<Value*, ValueLatticeElement> &Visited) {
SmallDenseMap<Value*, ValueLatticeElement> &Visited) {
if (ICmpInst *ICI = dyn_cast<ICmpInst>(Cond))
return getValueFromICmpCondition(Val, ICI, isTrueDest);

Expand Down Expand Up @@ -1315,7 +1315,7 @@ getValueFromConditionImpl(Value *Val, Value *Cond, bool isTrueDest,

static ValueLatticeElement
getValueFromCondition(Value *Val, Value *Cond, bool isTrueDest,
DenseMap<Value*, ValueLatticeElement> &Visited) {
SmallDenseMap<Value*, ValueLatticeElement> &Visited) {
auto I = Visited.find(Cond);
if (I != Visited.end())
return I->second;
Expand All @@ -1328,7 +1328,7 @@ getValueFromCondition(Value *Val, Value *Cond, bool isTrueDest,
ValueLatticeElement getValueFromCondition(Value *Val, Value *Cond,
bool isTrueDest) {
assert(Cond && "precondition");
DenseMap<Value*, ValueLatticeElement> Visited;
SmallDenseMap<Value*, ValueLatticeElement> Visited;
return getValueFromCondition(Val, Cond, isTrueDest, Visited);
}

Expand Down

0 comments on commit dbf78ae

Please sign in to comment.