On 9/27/07, Chris Lattner <[EMAIL PROTECTED]> wrote:
>
> On Sep 27, 2007, at 8:42 AM, Daniel Berlin wrote:
>
> > // Node class - This class is used to represent a node in the
> > constraint
> > @@ -1735,6 +1750,7 @@
> > /// replaced by their the pointer equivalence class representative.
> > void Andersens::RewriteConstraints() {
> > std::vector<Constraint> NewConstraints;
> > + std::set<Constraint> Seen;
> >
> > PEClass2Node.clear();
> > PENLEClass2Node.clear();
> > @@ -1768,12 +1784,14 @@
> > // it.
> > if (C.Src == C.Dest && C.Type == Constraint::Copy)
> > continue;
> > -
> > +
> > C.Src = FindEquivalentNode(RHSNode, RHSLabel);
> > C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
> > - if (C.Src == C.Dest && C.Type == Constraint::Copy)
> > + if (C.Src == C.Dest && C.Type == Constraint::Copy
> > + || Seen.count(C) != 0)
> > continue;
> >
> > + Seen.insert(C);
> > NewConstraints.push_back(C);
> > }
> > Constraints.swap(NewConstraints);
>
> std::set is inefficient for several reasons, particularly because
> every insertion does a malloc. If this is performance critical code
> you might want to try out SmallSet (assuming the set is small) or
> some sort of hash table like DenseMap.
It's not performance critical, but the sets aren't small. They can be
hundreds of thousands.
I was looking for something like DenseSet, but couldn't find it.
Should i just use DenseMap<Constraint, bool> then?
_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits