[llvm] d06131f - [AST] Pass BatchAA to mergeSetIn() (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 07:55:04 PDT 2022


Author: Nikita Popov
Date: 2022-10-18T16:54:55+02:00
New Revision: d06131fda21ebbd9caadac79215e0e12b20b390c

URL: https://github.com/llvm/llvm-project/commit/d06131fda21ebbd9caadac79215e0e12b20b390c
DIFF: https://github.com/llvm/llvm-project/commit/d06131fda21ebbd9caadac79215e0e12b20b390c.diff

LOG: [AST] Pass BatchAA to mergeSetIn() (NFCI)

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/AliasSetTracker.h
    llvm/lib/Analysis/AliasSetTracker.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/AliasSetTracker.h b/llvm/include/llvm/Analysis/AliasSetTracker.h
index 3a3c8095ad934..d36807082cfec 100644
--- a/llvm/include/llvm/Analysis/AliasSetTracker.h
+++ b/llvm/include/llvm/Analysis/AliasSetTracker.h
@@ -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.

diff  --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index b8b64d3890c4f..a7939e9607dd7 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -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!!");
 
@@ -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;
@@ -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);
     }
   }
 
@@ -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;
@@ -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;
@@ -592,7 +592,7 @@ AliasSet &AliasSetTracker::mergeAllAliasSets() {
     }
 
     // Otherwise, perform the actual merge.
-    AliasAnyAS->mergeSetIn(*Cur, *this);
+    AliasAnyAS->mergeSetIn(*Cur, *this, BatchAA);
   }
 
   return *AliasAnyAS;


        


More information about the llvm-commits mailing list