forked from OSchip/llvm-project
[NewGVN] Fix set comparison; reflow comment
Looks like we intended to compare this->Members with Other->Members here, but ended up comparing this->Members with this->Members. Oops. :) Since CongruenceClass::Members is a SmallPtrSet anyway, we can probably skip building std::sets if we're willing to write a bit more code. This appears to be no functional change (for sufficiently lax values of "no"): this equality check was only being called inside of an assert. So, worst case, we'll catch more bugs in the form of assertion failures. Thanks to d0k for noting this! llvm-svn: 333601
This commit is contained in:
parent
e2a20b1b29
commit
485762ccba
|
@ -366,9 +366,8 @@ public:
|
|||
// True if this class has no memory members.
|
||||
bool definesNoMemory() const { return StoreCount == 0 && memory_empty(); }
|
||||
|
||||
// Return true if two congruence classes are equivalent to each other. This
|
||||
// means
|
||||
// that every field but the ID number and the dead field are equivalent.
|
||||
// Return true if two congruence classes are equivalent to each other. This
|
||||
// means that every field but the ID number and the dead field are equivalent.
|
||||
bool isEquivalentTo(const CongruenceClass *Other) const {
|
||||
if (!Other)
|
||||
return false;
|
||||
|
@ -383,10 +382,12 @@ public:
|
|||
if (!DefiningExpr || !Other->DefiningExpr ||
|
||||
*DefiningExpr != *Other->DefiningExpr)
|
||||
return false;
|
||||
// We need some ordered set
|
||||
std::set<Value *> AMembers(Members.begin(), Members.end());
|
||||
std::set<Value *> BMembers(Members.begin(), Members.end());
|
||||
return AMembers == BMembers;
|
||||
|
||||
if (Members.size() != Other->Members.size())
|
||||
return false;
|
||||
|
||||
return all_of(Members,
|
||||
[&](const Value *V) { return Other->Members.count(V); });
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue