[PATCH] D56568: [AliasSetTracker] Store AliasResult and pass it on mergeSetIn.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 28 10:32:01 PST 2019
asbirlea updated this revision to Diff 183905.
asbirlea added a comment.
Rebase on top of NFC commit.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56568/new/
https://reviews.llvm.org/D56568
Files:
include/llvm/Analysis/AliasSetTracker.h
lib/Analysis/AliasSetTracker.cpp
Index: lib/Analysis/AliasSetTracker.cpp
===================================================================
--- lib/Analysis/AliasSetTracker.cpp
+++ lib/Analysis/AliasSetTracker.cpp
@@ -47,7 +47,7 @@
/// mergeSetIn - Merge the specified alias set into this alias set.
///
-void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) {
+void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST, AliasResult AR) {
assert(!AS.Forward && "Alias set is already forwarding!");
assert(!Forward && "This set is a forwarding set!!");
@@ -56,20 +56,8 @@
Access |= AS.Access;
Alias |= AS.Alias;
- if (Alias == SetMustAlias) {
- // 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.alias(MemoryLocation(L->getValue(), L->getSize(), L->getAAInfo()),
- MemoryLocation(R->getValue(), R->getSize(), R->getAAInfo())) !=
- MustAlias)
- Alias = SetMayAlias;
- }
+ if (Alias == SetMustAlias && AR != MustAlias)
+ Alias = SetMayAlias;
if (Alias == SetMayAlias) {
if (WasMustAlias)
@@ -299,12 +287,17 @@
AliasSet *FoundSet = nullptr;
for (iterator I = begin(), E = end(); I != E;) {
iterator Cur = I++;
- if (Cur->Forward || !Cur->aliasesPointer(Ptr, Size, AAInfo, AA)) continue;
+ if (Cur->Forward)
+ continue;
+
+ AliasResult AR = Cur->aliasesPointer(Ptr, Size, AAInfo, AA);
+ if (AR == NoAlias)
+ continue;
if (!FoundSet) { // If this is the first alias set ptr can go into.
FoundSet = &*Cur; // Remember it.
} else { // Otherwise, we must merge the sets.
- FoundSet->mergeSetIn(*Cur, *this); // Merge in contents.
+ FoundSet->mergeSetIn(*Cur, *this, AR); // Merge in contents.
}
}
@@ -320,7 +313,7 @@
if (!FoundSet) // If this is the first alias set ptr can go into.
FoundSet = &*Cur; // Remember it.
else // Otherwise, we must merge the sets.
- FoundSet->mergeSetIn(*Cur, *this); // Merge in contents.
+ FoundSet->mergeSetIn(*Cur, *this, MayAlias); // Merge in contents.
}
return FoundSet;
}
@@ -600,7 +593,7 @@
}
// Otherwise, perform the actual merge.
- AliasAnyAS->mergeSetIn(*Cur, *this);
+ AliasAnyAS->mergeSetIn(*Cur, *this, MayAlias);
}
return *AliasAnyAS;
Index: include/llvm/Analysis/AliasSetTracker.h
===================================================================
--- include/llvm/Analysis/AliasSetTracker.h
+++ include/llvm/Analysis/AliasSetTracker.h
@@ -212,7 +212,7 @@
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, AliasResult AR);
// Alias Set iteration - Allow access to all of the pointers which are part of
// this alias set.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56568.183905.patch
Type: text/x-patch
Size: 3221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190128/0b179e57/attachment.bin>
More information about the llvm-commits
mailing list