@@ -600,9 +600,10 @@ class EquivalenceClass : public llvm::FoldingSetNode {
600
600
areEqual (ProgramStateRef State, SymbolRef First, SymbolRef Second);
601
601
602
602
// / Iterate over all symbols and try to simplify them.
603
- LLVM_NODISCARD ProgramStateRef simplify (SValBuilder &SVB,
604
- RangeSet::Factory &F,
605
- ProgramStateRef State);
603
+ LLVM_NODISCARD static inline ProgramStateRef simplify (SValBuilder &SVB,
604
+ RangeSet::Factory &F,
605
+ ProgramStateRef State,
606
+ EquivalenceClass Class);
606
607
607
608
void dumpToStream (ProgramStateRef State, raw_ostream &os) const ;
608
609
LLVM_DUMP_METHOD void dump (ProgramStateRef State) const {
@@ -1696,7 +1697,7 @@ bool ConstraintAssignor::assignSymExprToConst(const SymExpr *Sym,
1696
1697
ClassMembersTy Members = State->get <ClassMembers>();
1697
1698
for (std::pair<EquivalenceClass, SymbolSet> ClassToSymbolSet : Members) {
1698
1699
EquivalenceClass Class = ClassToSymbolSet.first ;
1699
- State = Class. simplify (Builder, RangeFactory, State);
1700
+ State = EquivalenceClass:: simplify (Builder, RangeFactory, State, Class );
1700
1701
if (!State)
1701
1702
return false ;
1702
1703
SimplifiedClasses.insert (Class);
@@ -1710,7 +1711,7 @@ bool ConstraintAssignor::assignSymExprToConst(const SymExpr *Sym,
1710
1711
EquivalenceClass Class = ClassConstraint.first ;
1711
1712
if (SimplifiedClasses.count (Class)) // Already simplified.
1712
1713
continue ;
1713
- State = Class. simplify (Builder, RangeFactory, State);
1714
+ State = EquivalenceClass:: simplify (Builder, RangeFactory, State, Class );
1714
1715
if (!State)
1715
1716
return false ;
1716
1717
}
@@ -2090,18 +2091,17 @@ inline Optional<bool> EquivalenceClass::areEqual(ProgramStateRef State,
2090
2091
// class to this class. This way, we simplify not just the symbols but the
2091
2092
// classes as well: we strive to keep the number of the classes to be the
2092
2093
// absolute minimum.
2093
- LLVM_NODISCARD ProgramStateRef EquivalenceClass::simplify (
2094
- SValBuilder &SVB, RangeSet::Factory &F, ProgramStateRef State) {
2095
- SymbolSet ClassMembers = getClassMembers (State);
2094
+ LLVM_NODISCARD ProgramStateRef
2095
+ EquivalenceClass::simplify (SValBuilder &SVB, RangeSet::Factory &F,
2096
+ ProgramStateRef State, EquivalenceClass Class) {
2097
+ SymbolSet ClassMembers = Class.getClassMembers (State);
2096
2098
for (const SymbolRef &MemberSym : ClassMembers) {
2097
2099
SymbolRef SimplifiedMemberSym = ento::simplify (State, MemberSym);
2098
2100
if (SimplifiedMemberSym && MemberSym != SimplifiedMemberSym) {
2099
- EquivalenceClass ClassOfSimplifiedSym =
2100
- EquivalenceClass::find (State, SimplifiedMemberSym);
2101
2101
// The simplified symbol should be the member of the original Class,
2102
2102
// however, it might be in another existing class at the moment. We
2103
2103
// have to merge these classes.
2104
- State = merge (F, State, ClassOfSimplifiedSym );
2104
+ State = merge (F, State, MemberSym, SimplifiedMemberSym );
2105
2105
if (!State)
2106
2106
return nullptr ;
2107
2107
}
0 commit comments