[PATCH] D77137: [Reassociate] Preserve AAManager and BasicAA analyses

Kirill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 05:32:05 PDT 2020


kpolushin created this revision.
kpolushin added reviewers: spatel, lebedev.ri, efriedma, qcolombet, mcrosier, davide, dsanders, fhahn.
kpolushin added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.

Now Reassociate Pass invalidates the analysis results of AAManager and BasicAA, but it saves GlobalsAA, although it seems that it should preserve them, since it affects only Unary and Binary operators.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77137

Files:
  llvm/lib/Transforms/Scalar/Reassociate.cpp


Index: llvm/lib/Transforms/Scalar/Reassociate.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -29,6 +29,7 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/BasicAliasAnalysis.h"
 #include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/Argument.h"
@@ -2457,6 +2458,8 @@
   if (MadeChange) {
     PreservedAnalyses PA;
     PA.preserveSet<CFGAnalyses>();
+    PA.preserve<AAManager>();
+    PA.preserve<BasicAA>();
     PA.preserve<GlobalsAA>();
     return PA;
   }
@@ -2487,6 +2490,8 @@
 
     void getAnalysisUsage(AnalysisUsage &AU) const override {
       AU.setPreservesCFG();
+      AU.addPreserved<AAResultsWrapperPass>();
+      AU.addPreserved<BasicAAWrapperPass>();
       AU.addPreserved<GlobalsAAWrapperPass>();
     }
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77137.253520.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/a22152c2/attachment-0001.bin>


More information about the llvm-commits mailing list