Reapply "[EquivalenceClasses] Replace findValue with contains (NFC)."
This reverts the revert commit 616f447fc8.
It includes updates to remaining users in Polly and Clang, to avoid
failures when building those projects.
This commit is contained in:
@@ -64,9 +64,9 @@ projectToLeaders(const llvm::DenseSet<Atom> &Atoms,
|
||||
// `LeaderIt`.
|
||||
static llvm::SmallVector<Atom>
|
||||
atomsInEquivalenceClass(const llvm::EquivalenceClasses<Atom> &EquivalentAtoms,
|
||||
llvm::EquivalenceClasses<Atom>::iterator LeaderIt) {
|
||||
const Atom &At) {
|
||||
llvm::SmallVector<Atom> Result;
|
||||
for (auto MemberIt = EquivalentAtoms.member_begin(LeaderIt);
|
||||
for (auto MemberIt = EquivalentAtoms.findLeader(At);
|
||||
MemberIt != EquivalentAtoms.member_end(); ++MemberIt)
|
||||
Result.push_back(*MemberIt);
|
||||
return Result;
|
||||
@@ -159,19 +159,17 @@ void simplifyConstraints(llvm::SetVector<const Formula *> &Constraints,
|
||||
if (TrueAtoms.contains(At) || FalseAtoms.contains(At))
|
||||
continue;
|
||||
llvm::SmallVector<Atom> Atoms =
|
||||
atomsInEquivalenceClass(EquivalentAtoms, It);
|
||||
atomsInEquivalenceClass(EquivalentAtoms, At);
|
||||
if (Atoms.size() == 1)
|
||||
continue;
|
||||
std::sort(Atoms.begin(), Atoms.end());
|
||||
Info->EquivalentAtoms.push_back(std::move(Atoms));
|
||||
}
|
||||
for (Atom At : TrueAtoms)
|
||||
Info->TrueAtoms.append(atomsInEquivalenceClass(
|
||||
EquivalentAtoms, EquivalentAtoms.findValue(At)));
|
||||
Info->TrueAtoms.append(atomsInEquivalenceClass(EquivalentAtoms, At));
|
||||
std::sort(Info->TrueAtoms.begin(), Info->TrueAtoms.end());
|
||||
for (Atom At : FalseAtoms)
|
||||
Info->FalseAtoms.append(atomsInEquivalenceClass(
|
||||
EquivalentAtoms, EquivalentAtoms.findValue(At)));
|
||||
Info->FalseAtoms.append(atomsInEquivalenceClass(EquivalentAtoms, At));
|
||||
std::sort(Info->FalseAtoms.begin(), Info->FalseAtoms.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,10 +179,9 @@ public:
|
||||
return member_iterator(nullptr);
|
||||
}
|
||||
|
||||
/// findValue - Return an iterator to the specified value. If it does not
|
||||
/// exist, end() is returned.
|
||||
iterator findValue(const ElemTy &V) const {
|
||||
return TheMapping.find(V);
|
||||
/// Returns true if \p V is contained an equivalence class.
|
||||
bool contains(const ElemTy &V) const {
|
||||
return TheMapping.find(V) != TheMapping.end();
|
||||
}
|
||||
|
||||
/// getLeaderValue - Return the leader for the specified value that is in the
|
||||
|
||||
@@ -1230,7 +1230,7 @@ bool AccessAnalysis::canCheckPtrAtRT(
|
||||
[this](const Value *Ptr) {
|
||||
MemAccessInfo AccessWrite(const_cast<Value *>(Ptr),
|
||||
true);
|
||||
return DepCands.findValue(AccessWrite) == DepCands.end();
|
||||
return !DepCands.contains(AccessWrite);
|
||||
})) &&
|
||||
"Can only skip updating CanDoRT below, if all entries in AS "
|
||||
"are reads or there is at most 1 entry");
|
||||
|
||||
@@ -1856,8 +1856,7 @@ static void joinOperandTree(EquivalenceClasses<Instruction *> &UnionFind,
|
||||
continue;
|
||||
|
||||
// Check if OpInst is in the BB and is a modeled instruction.
|
||||
auto OpVal = UnionFind.findValue(OpInst);
|
||||
if (OpVal == UnionFind.end())
|
||||
if (!UnionFind.contains(OpInst))
|
||||
continue;
|
||||
|
||||
UnionFind.unionSets(Inst, OpInst);
|
||||
|
||||
Reference in New Issue
Block a user