Skip to content

Commit

Permalink
[AST] Pass BatchAA to mergeSetIn() (NFCI)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Oct 18, 2022
1 parent 9fde8e9 commit d06131f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/AliasSetTracker.h
Expand Up @@ -209,7 +209,7 @@ class AliasSet : public ilist_node<AliasSet> {
bool isForwardingAliasSet() const { return Forward; }

/// Merge the specified alias set into this alias set.
void mergeSetIn(AliasSet &AS, AliasSetTracker &AST);
void mergeSetIn(AliasSet &AS, AliasSetTracker &AST, BatchAAResults &BatchAA);

// Alias Set iteration - Allow access to all of the pointers which are part of
// this alias set.
Expand Down
14 changes: 7 additions & 7 deletions llvm/lib/Analysis/AliasSetTracker.cpp
Expand Up @@ -40,8 +40,8 @@ static cl::opt<unsigned>
"sets may contain before degradation"));

/// mergeSetIn - Merge the specified alias set into this alias set.
///
void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) {
void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST,
BatchAAResults &BatchAA) {
assert(!AS.Forward && "Alias set is already forwarding!");
assert(!Forward && "This set is a forwarding set!!");

Expand All @@ -54,12 +54,11 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) {
// Check that these two merged sets really are must aliases. Since both
// used to be must-alias sets, we can just check any pointer from each set
// for aliasing.
AliasAnalysis &AA = AST.getAliasAnalysis();
PointerRec *L = getSomePointer();
PointerRec *R = AS.getSomePointer();

// If the pointers are not a must-alias pair, this set becomes a may alias.
if (!AA.isMustAlias(
if (!BatchAA.isMustAlias(
MemoryLocation(L->getValue(), L->getSize(), L->getAAInfo()),
MemoryLocation(R->getValue(), R->getSize(), R->getAAInfo())))
Alias = SetMayAlias;
Expand Down Expand Up @@ -292,7 +291,7 @@ AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr,
FoundSet = &AS;
} else {
// Otherwise, we must merge the sets.
FoundSet->mergeSetIn(AS, *this);
FoundSet->mergeSetIn(AS, *this, BatchAA);
}
}

Expand All @@ -310,7 +309,7 @@ AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
FoundSet = &AS;
} else {
// Otherwise, we must merge the sets.
FoundSet->mergeSetIn(AS, *this);
FoundSet->mergeSetIn(AS, *this, BatchAA);
}
}
return FoundSet;
Expand Down Expand Up @@ -581,6 +580,7 @@ AliasSet &AliasSetTracker::mergeAllAliasSets() {
AliasAnyAS->Access = AliasSet::ModRefAccess;
AliasAnyAS->AliasAny = true;

BatchAAResults BatchAA(AA);
for (auto *Cur : ASVector) {
// If Cur was already forwarding, just forward to the new AS instead.
AliasSet *FwdTo = Cur->Forward;
Expand All @@ -592,7 +592,7 @@ AliasSet &AliasSetTracker::mergeAllAliasSets() {
}

// Otherwise, perform the actual merge.
AliasAnyAS->mergeSetIn(*Cur, *this);
AliasAnyAS->mergeSetIn(*Cur, *this, BatchAA);
}

return *AliasAnyAS;
Expand Down

0 comments on commit d06131f

Please sign in to comment.