@@ -52,16 +52,15 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST,
52
52
Alias |= AS.Alias ;
53
53
54
54
if (Alias == SetMustAlias) {
55
- // Check that these two merged sets really are must aliases.
56
- // If the pointers are not a must-alias pair, this set becomes a may alias.
57
- [&] {
58
- for (const MemoryLocation &MemLoc : *this )
59
- for (const MemoryLocation &ASMemLoc : AS)
60
- if (!BatchAA.isMustAlias (MemLoc, ASMemLoc)) {
61
- Alias = SetMayAlias;
62
- return ;
63
- }
64
- }();
55
+ // Check that these two merged sets really are must aliases. If we cannot
56
+ // find a must-alias pair between them, this set becomes a may alias.
57
+ if (!llvm::any_of (MemoryLocs, [&](const MemoryLocation &MemLoc) {
58
+ return llvm::any_of (AS.MemoryLocs ,
59
+ [&](const MemoryLocation &ASMemLoc) {
60
+ return BatchAA.isMustAlias (MemLoc, ASMemLoc);
61
+ });
62
+ }))
63
+ Alias = SetMayAlias;
65
64
}
66
65
67
66
// Merge the list of constituent pointers...
@@ -113,13 +112,14 @@ void AliasSet::removeFromTracker(AliasSetTracker &AST) {
113
112
114
113
void AliasSet::addPointer (AliasSetTracker &AST, const MemoryLocation &MemLoc,
115
114
bool KnownMustAlias) {
116
- // Check to see if we have to downgrade to _may_ alias.
117
- if (isMustAlias () && !KnownMustAlias)
118
- for (const MemoryLocation &ASMemLoc : MemoryLocs)
119
- if (!AST.getAliasAnalysis ().isMustAlias (ASMemLoc, MemLoc)) {
120
- Alias = SetMayAlias;
121
- break ;
122
- }
115
+ if (isMustAlias () && !KnownMustAlias) {
116
+ // If we cannot find a must-alias with any of the existing MemoryLocs, we
117
+ // must downgrade to may-alias.
118
+ if (!llvm::any_of (MemoryLocs, [&](const MemoryLocation &ASMemLoc) {
119
+ return AST.getAliasAnalysis ().isMustAlias (MemLoc, ASMemLoc);
120
+ }))
121
+ Alias = SetMayAlias;
122
+ }
123
123
124
124
// Add it to the end of the list...
125
125
MemoryLocs.push_back (MemLoc);
0 commit comments