[PATCH] D93914: [NewPM][AMDGPU] Make amdgpu-aa work with NewPM

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 2 19:33:50 PST 2021


aeubanks updated this revision to Diff 314265.
aeubanks added a comment.

separate out rename


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93914/new/

https://reviews.llvm.org/D93914

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
  llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll


Index: llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
+++ llvm/test/CodeGen/AMDGPU/amdgpu-alias-analysis.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -mtriple=amdgcn-- -data-layout=A5 -aa-eval -amdgpu-aa -amdgpu-aa-wrapper -disable-basic-aa  -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
 ; RUN: opt -mtriple=r600-- -data-layout=A5 -aa-eval -amdgpu-aa -amdgpu-aa-wrapper -disable-basic-aa  -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
+; RUN: opt -mtriple=amdgcn-- -data-layout=A5 -passes=aa-eval -aa-pipeline=amdgpu-aa -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
+; RUN: opt -mtriple=r600-- -data-layout=A5 -passes=aa-eval -aa-pipeline=amdgpu-aa -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
 
 ; CHECK: NoAlias:      i8 addrspace(1)* %p1, i8 addrspace(5)* %p
 
Index: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
@@ -58,6 +58,7 @@
 
   void registerPassBuilderCallbacks(PassBuilder &PB,
                                     bool DebugPassManager) override;
+  void registerDefaultAliasAnalyses(AAManager &) override;
 
   /// Get the integer value of a null pointer in the given address space.
   static int64_t getNullPointerValue(unsigned AddrSpace) {
Index: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -487,6 +487,10 @@
   });
 }
 
+void AMDGPUTargetMachine::registerDefaultAliasAnalyses(AAManager &AAM) {
+  AAM.registerFunctionAnalysis<AMDGPUAA>();
+}
+
 void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB,
                                                        bool DebugPassManager) {
   PB.registerPipelineParsingCallback(
@@ -515,6 +519,18 @@
         return false;
       });
 
+  PB.registerAnalysisRegistrationCallback([](FunctionAnalysisManager &FAM) {
+    FAM.registerPass([&] { return AMDGPUAA(); });
+  });
+
+  PB.registerParseAACallback([](StringRef AAName, AAManager &AAM) {
+    if (AAName == "amdgpu-aa") {
+      AAM.registerFunctionAnalysis<AMDGPUAA>();
+      return true;
+    }
+    return false;
+  });
+
   PB.registerPipelineStartEPCallback([DebugPassManager](
                                          ModulePassManager &PM,
                                          PassBuilder::OptimizationLevel Level) {
Index: llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
+++ llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
@@ -42,7 +42,10 @@
   /// Handle invalidation events from the new pass manager.
   ///
   /// By definition, this result is stateless and so remains valid.
-  bool invalidate(Function &, const PreservedAnalyses &) { return false; }
+  bool invalidate(Function &, const PreservedAnalyses &,
+                  FunctionAnalysisManager::Invalidator &Inv) {
+    return false;
+  }
 
   AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB,
                     AAQueryInfo &AAQI);
@@ -54,7 +57,7 @@
 class AMDGPUAA : public AnalysisInfoMixin<AMDGPUAA> {
   friend AnalysisInfoMixin<AMDGPUAA>;
 
-  static char PassID;
+  static AnalysisKey Key;
 
 public:
   using Result = AMDGPUAAResult;
Index: llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
@@ -32,6 +32,8 @@
 
 #define DEBUG_TYPE "amdgpu-aa"
 
+AnalysisKey AMDGPUAA::Key;
+
 // Register this pass...
 char AMDGPUAAWrapperPass::ID = 0;
 char AMDGPUExternalAAWrapper::ID = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93914.314265.patch
Type: text/x-patch
Size: 4046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210103/c5bcaf6c/attachment.bin>


More information about the llvm-commits mailing list