Skip to content

Commit e1c2fbf

Browse files
committed
Document isMustAliasMerge method
1 parent 56a6a53 commit e1c2fbf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

llvm/include/llvm/Analysis/AliasSetTracker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ class AliasSet : public ilist_node<AliasSet> {
149149

150150
void removeFromTracker(AliasSetTracker &AST);
151151

152-
bool isMustAliasMergeWith(AliasSet &AS, BatchAAResults &BatchAA) const;
153152
void addPointer(AliasSetTracker &AST, const MemoryLocation &MemLoc,
154153
bool KnownMustAlias = false);
155154
void addUnknownInst(Instruction *I, BatchAAResults &AA);

llvm/lib/Analysis/AliasSetTracker.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ static cl::opt<unsigned>
4040
cl::desc("The maximum number of pointers may-alias "
4141
"sets may contain before degradation"));
4242

43-
bool AliasSet::isMustAliasMergeWith(AliasSet &AS,
44-
BatchAAResults &BatchAA) const {
45-
for (const MemoryLocation &MemLoc : MemoryLocs)
46-
for (const MemoryLocation &ASMemLoc : AS.MemoryLocs)
47-
if (!BatchAA.isMustAlias(MemLoc, ASMemLoc))
43+
/// For the given two alias sets, when known that the sets are must-aliases
44+
/// individually, check whether their union preserves the must-alias status.
45+
static bool isMustAliasMerge(const AliasSet &AS, const AliasSet &OtherAS,
46+
BatchAAResults &BatchAA) {
47+
// Since the sets are must-aliases individually, we must only check
48+
// the pairs across the sets.
49+
for (const MemoryLocation &MemLoc : AS)
50+
for (const MemoryLocation &OtherMemLoc : OtherAS)
51+
if (!BatchAA.isMustAlias(MemLoc, OtherMemLoc))
4852
return false;
4953
return true;
5054
}
@@ -62,7 +66,7 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST,
6266
if (Alias == SetMustAlias) {
6367
// Check that these two merged sets really are must aliases.
6468
// If the pointers are not a must-alias pair, this set becomes a may alias.
65-
if (!isMustAliasMergeWith(AS, BatchAA))
69+
if (!isMustAliasMerge(*this, AS, BatchAA))
6670
Alias = SetMayAlias;
6771
}
6872

0 commit comments

Comments
 (0)