@@ -40,11 +40,15 @@ static cl::opt<unsigned>
40
40
cl::desc(" The maximum number of pointers may-alias "
41
41
" sets may contain before degradation" ));
42
42
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))
48
52
return false ;
49
53
return true ;
50
54
}
@@ -62,7 +66,7 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST,
62
66
if (Alias == SetMustAlias) {
63
67
// Check that these two merged sets really are must aliases.
64
68
// 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))
66
70
Alias = SetMayAlias;
67
71
}
68
72
0 commit comments