llvm.org GIT mirror llvm / c7a12ae
Ignore redundant constraints git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42397 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Berlin 13 years ago
1 changed file(s) with 20 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
133133 assert(Offset == 0 || Ty != AddressOf &&
134134 "Offset is illegal on addressof constraints");
135135 }
136 bool operator==(const Constraint &RHS) const {
137 return RHS.Type == Type
138 && RHS.Dest == Dest
139 && RHS.Src == Src
140 && RHS.Offset == Offset;
141 }
142 bool operator<(const Constraint &RHS) const {
143 if (RHS.Type != Type)
144 return RHS.Type < Type;
145 else if (RHS.Dest != Dest)
146 return RHS.Dest < Dest;
147 else if (RHS.Src != Src)
148 return RHS.Src < Src;
149 return RHS.Offset < Offset;
150 }
136151 };
137152
138153 // Node class - This class is used to represent a node in the constraint
17341749 /// replaced by their the pointer equivalence class representative.
17351750 void Andersens::RewriteConstraints() {
17361751 std::vector NewConstraints;
1752 std::set Seen;
17371753
17381754 PEClass2Node.clear();
17391755 PENLEClass2Node.clear();
17671783 // it.
17681784 if (C.Src == C.Dest && C.Type == Constraint::Copy)
17691785 continue;
1770
1786
17711787 C.Src = FindEquivalentNode(RHSNode, RHSLabel);
17721788 C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
1773 if (C.Src == C.Dest && C.Type == Constraint::Copy)
1789 if (C.Src == C.Dest && C.Type == Constraint::Copy
1790 || Seen.count(C) != 0)
17741791 continue;
17751792
1793 Seen.insert(C);
17761794 NewConstraints.push_back(C);
17771795 }
17781796 Constraints.swap(NewConstraints);