[llvm] [AMDGPU][NewPM] Port "AMDGPUResourceUsageAnalysis" to NPM (PR #130959)

Vikram Hegde via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 18 00:47:49 PDT 2025


https://github.com/vikramRH updated https://github.com/llvm/llvm-project/pull/130959

>From 69187af8b4e6ea69d574a43f41f08a0560f157cb Mon Sep 17 00:00:00 2001
From: vikhegde <vikram.hegde at amd.com>
Date: Wed, 12 Mar 2025 15:09:05 +0530
Subject: [PATCH 1/3] [AMDGPU][NewPM] Port "AMDGPUResourceUsageAnalysis" to NPM

---
 .../llvm/Passes/TargetPassRegistry.inc        |  5 ++-
 llvm/lib/Target/AMDGPU/AMDGPU.h               |  2 +-
 llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp   |  8 ++--
 llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h     |  2 +-
 .../Target/AMDGPU/AMDGPUMCResourceInfo.cpp    |  2 +-
 llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h |  2 +-
 llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def |  7 +++
 .../AMDGPU/AMDGPUResourceUsageAnalysis.cpp    | 44 +++++++++++++++----
 .../AMDGPU/AMDGPUResourceUsageAnalysis.h      | 39 ++++++++++++----
 .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp |  3 +-
 10 files changed, 86 insertions(+), 28 deletions(-)

diff --git a/llvm/include/llvm/Passes/TargetPassRegistry.inc b/llvm/include/llvm/Passes/TargetPassRegistry.inc
index 521913cb25a4a..068b27794191c 100644
--- a/llvm/include/llvm/Passes/TargetPassRegistry.inc
+++ b/llvm/include/llvm/Passes/TargetPassRegistry.inc
@@ -187,12 +187,13 @@ PB.registerAnalysisRegistrationCallback([](LoopAnalysisManager &AM) {
 #undef LOOP_ANALYSIS
 });
 
-PB.registerAnalysisRegistrationCallback([](MachineFunctionAnalysisManager &AM) {
+PB.registerAnalysisRegistrationCallback(
+    [=](MachineFunctionAnalysisManager &AM) {
 #define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)                           \
   AM.registerPass([&] { return CREATE_PASS; });
 #include GET_PASS_REGISTRY
 #undef MACHINE_FUNCTION_ANALYSIS
-});
+    });
 
 #undef GET_PASS_REGISTRY
 #endif // GET_PASS_REGISTRY
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h
index 90ba5cfb2f65a..6cb1720c4d334 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.h
@@ -371,7 +371,7 @@ ModulePass *createAMDGPUPrintfRuntimeBinding();
 void initializeAMDGPUPrintfRuntimeBindingPass(PassRegistry&);
 extern char &AMDGPUPrintfRuntimeBindingID;
 
-void initializeAMDGPUResourceUsageAnalysisPass(PassRegistry &);
+void initializeAMDGPUResourceUsageAnalysisWrapperPassPass(PassRegistry &);
 extern char &AMDGPUResourceUsageAnalysisID;
 
 struct AMDGPUPrintfRuntimeBindingPass
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 31e0bd8d652bc..e29b290442d14 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -643,7 +643,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   if (!IsTargetStreamerInitialized)
     initTargetStreamer(*MF.getFunction().getParent());
 
-  ResourceUsage = &getAnalysis<AMDGPUResourceUsageAnalysis>();
+  ResourceUsage = &getAnalysis<AMDGPUResourceUsageAnalysisWrapperPass>();
   CurrentProgramInfo.reset(MF);
 
   const AMDGPUMachineFunction *MFI = MF.getInfo<AMDGPUMachineFunction>();
@@ -665,7 +665,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     OutStreamer->switchSection(ConfigSection);
   }
 
-  const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &Info =
+  const AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo &Info =
       ResourceUsage->getResourceInfo();
   RI.gatherResourceInfo(MF, Info, OutContext);
 
@@ -1657,8 +1657,8 @@ bool AMDGPUAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
 }
 
 void AMDGPUAsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
-  AU.addRequired<AMDGPUResourceUsageAnalysis>();
-  AU.addPreserved<AMDGPUResourceUsageAnalysis>();
+  AU.addRequired<AMDGPUResourceUsageAnalysisWrapperPass>();
+  AU.addPreserved<AMDGPUResourceUsageAnalysisWrapperPass>();
   AU.addRequired<MachineModuleInfoWrapperPass>();
   AU.addPreserved<MachineModuleInfoWrapperPass>();
   AsmPrinter::getAnalysisUsage(AU);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
index 2c959d7dbbd07..6c40157ab07b6 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
@@ -40,7 +40,7 @@ class AMDGPUAsmPrinter final : public AsmPrinter {
   unsigned CodeObjectVersion;
   void initializeTargetID(const Module &M);
 
-  AMDGPUResourceUsageAnalysis *ResourceUsage;
+  AMDGPUResourceUsageAnalysisWrapperPass *ResourceUsage;
 
   MCResourceInfo RI;
 
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
index 9ad4bd3c77ab4..c1f88b559960f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
@@ -164,7 +164,7 @@ void MCResourceInfo::assignResourceInfoExpr(
 
 void MCResourceInfo::gatherResourceInfo(
     const MachineFunction &MF,
-    const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &FRI,
+    const AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo &FRI,
     MCContext &OutContext) {
   // Worst case VGPR use for non-hardware-entrypoints.
   MCSymbol *MaxVGPRSym = getMaxVGPRSymbol(OutContext);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
index a670878948c31..19ee117074511 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
@@ -92,7 +92,7 @@ class MCResourceInfo {
   /// functions with indirect calls should be assigned the module level maximum.
   void gatherResourceInfo(
       const MachineFunction &MF,
-      const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &FRI,
+      const AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo &FRI,
       MCContext &OutContext);
 
   const MCExpr *createTotalNumVGPRs(const MachineFunction &MF, MCContext &Ctx);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def b/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
index c5d3207acf0f5..00e5e08ee13d0 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
@@ -93,6 +93,13 @@ FUNCTION_PASS_WITH_PARAMS(
     parseAMDGPUAtomicOptimizerStrategy, "strategy=dpp|iterative|none")
 #undef FUNCTION_PASS_WITH_PARAMS
 
+#ifndef MACHINE_FUNCTION_ANALYSIS
+#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
+#endif
+
+MACHINE_FUNCTION_ANALYSIS("amdgpu-resource-usage", AMDGPUResourceUsageAnalysis(static_cast<const GCNTargetMachine *>(this)))
+#undef MACHINE_FUNCTION_ANALYSIS
+
 #ifndef MACHINE_FUNCTION_PASS
 #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
 #endif
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index 9a609a1752de0..ac251cd07a50a 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -30,8 +30,9 @@ using namespace llvm::AMDGPU;
 
 #define DEBUG_TYPE "amdgpu-resource-usage"
 
-char llvm::AMDGPUResourceUsageAnalysis::ID = 0;
-char &llvm::AMDGPUResourceUsageAnalysisID = AMDGPUResourceUsageAnalysis::ID;
+char llvm::AMDGPUResourceUsageAnalysisWrapperPass::ID = 0;
+char &llvm::AMDGPUResourceUsageAnalysisID =
+    AMDGPUResourceUsageAnalysisWrapperPass::ID;
 
 // In code object v4 and older, we need to tell the runtime some amount ahead of
 // time if we don't know the true stack size. Assume a smaller number if this is
@@ -47,7 +48,7 @@ static cl::opt<uint32_t> clAssumedStackSizeForDynamicSizeObjects(
              "variable sized objects (in bytes)"),
     cl::Hidden, cl::init(4096));
 
-INITIALIZE_PASS(AMDGPUResourceUsageAnalysis, DEBUG_TYPE,
+INITIALIZE_PASS(AMDGPUResourceUsageAnalysisWrapperPass, DEBUG_TYPE,
                 "Function register usage analysis", true, true)
 
 static const Function *getCalleeFunction(const MachineOperand &Op) {
@@ -68,7 +69,8 @@ static bool hasAnyNonFlatUseOfReg(const MachineRegisterInfo &MRI,
   return false;
 }
 
-bool AMDGPUResourceUsageAnalysis::runOnMachineFunction(MachineFunction &MF) {
+bool AMDGPUResourceUsageAnalysisWrapperPass::runOnMachineFunction(
+    MachineFunction &MF) {
   auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
   if (!TPC)
     return false;
@@ -90,14 +92,40 @@ bool AMDGPUResourceUsageAnalysis::runOnMachineFunction(MachineFunction &MF) {
       AssumedStackSizeForExternalCall = 0;
   }
 
-  ResourceInfo = analyzeResourceUsage(MF, AssumedStackSizeForDynamicSizeObjects,
-                                      AssumedStackSizeForExternalCall);
+  ResourceInfo = AMDGPUResourceUsageAnalysisImpl().analyzeResourceUsage(
+      MF, AssumedStackSizeForDynamicSizeObjects,
+      AssumedStackSizeForExternalCall);
 
   return false;
 }
 
-AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo
-AMDGPUResourceUsageAnalysis::analyzeResourceUsage(
+AnalysisKey AMDGPUResourceUsageAnalysis::Key;
+AMDGPUResourceUsageAnalysis::Result
+AMDGPUResourceUsageAnalysis::run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM) {
+  const MCSubtargetInfo &STI = *TM->getMCSubtargetInfo();
+
+  // By default, for code object v5 and later, track only the minimum scratch
+  // size
+  uint32_t AssumedStackSizeForDynamicSizeObjects =
+      clAssumedStackSizeForDynamicSizeObjects;
+  uint32_t AssumedStackSizeForExternalCall = clAssumedStackSizeForExternalCall;
+  if (AMDGPU::getAMDHSACodeObjectVersion(*MF.getFunction().getParent()) >=
+          AMDGPU::AMDHSA_COV5 ||
+      STI.getTargetTriple().getOS() == Triple::AMDPAL) {
+    if (!clAssumedStackSizeForDynamicSizeObjects.getNumOccurrences())
+      AssumedStackSizeForDynamicSizeObjects = 0;
+    if (!clAssumedStackSizeForExternalCall.getNumOccurrences())
+      AssumedStackSizeForExternalCall = 0;
+  }
+
+  return AMDGPUResourceUsageAnalysisImpl().analyzeResourceUsage(
+      MF, AssumedStackSizeForDynamicSizeObjects,
+      AssumedStackSizeForExternalCall);
+}
+
+AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo
+AMDGPUResourceUsageAnalysisImpl::analyzeResourceUsage(
     const MachineFunction &MF, uint32_t AssumedStackSizeForDynamicSizeObjects,
     uint32_t AssumedStackSizeForExternalCall) const {
   SIFunctionResourceInfo Info;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
index 92ef41f49b3ba..00b56889a8190 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
@@ -17,6 +17,7 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/IR/PassManager.h"
 
 namespace llvm {
 
@@ -24,7 +25,7 @@ class GCNSubtarget;
 class MachineFunction;
 class TargetMachine;
 
-struct AMDGPUResourceUsageAnalysis : public MachineFunctionPass {
+struct AMDGPUResourceUsageAnalysisImpl {
 public:
   static char ID;
   // Track resource usage for callee functions.
@@ -44,23 +45,43 @@ struct AMDGPUResourceUsageAnalysis : public MachineFunctionPass {
     SmallVector<const Function *, 16> Callees;
   };
 
-  AMDGPUResourceUsageAnalysis() : MachineFunctionPass(ID) {}
+  SIFunctionResourceInfo
+  analyzeResourceUsage(const MachineFunction &MF,
+                       uint32_t AssumedStackSizeForDynamicSizeObjects,
+                       uint32_t AssumedStackSizeForExternalCall) const;
+};
+
+struct AMDGPUResourceUsageAnalysisWrapperPass : public MachineFunctionPass {
+  using ResultT = AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo;
+  ResultT ResourceInfo;
+
+public:
+  static char ID;
+  AMDGPUResourceUsageAnalysisWrapperPass() : MachineFunctionPass(ID) {}
 
   bool runOnMachineFunction(MachineFunction &MF) override;
 
-  const SIFunctionResourceInfo &getResourceInfo() const { return ResourceInfo; }
+  const ResultT &getResourceInfo() const { return ResourceInfo; }
 
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.setPreservesAll();
     MachineFunctionPass::getAnalysisUsage(AU);
   }
+};
 
-private:
-  SIFunctionResourceInfo
-  analyzeResourceUsage(const MachineFunction &MF,
-                       uint32_t AssumedStackSizeForDynamicSizeObjects,
-                       uint32_t AssumedStackSizeForExternalCall) const;
-  SIFunctionResourceInfo ResourceInfo;
+class AMDGPUResourceUsageAnalysis
+    : public AnalysisInfoMixin<AMDGPUResourceUsageAnalysis> {
+  friend AnalysisInfoMixin<AMDGPUResourceUsageAnalysis>;
+  static AnalysisKey Key;
+
+  const TargetMachine *TM;
+
+public:
+  using Result = AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo;
+  Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
+
+  AMDGPUResourceUsageAnalysis(const TargetMachine *TM_) : TM(TM_) {}
 };
+
 } // namespace llvm
 #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPURESOURCEUSAGEANALYSIS_H
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index d5d375e473d04..08a39096df8e2 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -26,6 +26,7 @@
 #include "AMDGPUPerfHintAnalysis.h"
 #include "AMDGPURemoveIncompatibleFunctions.h"
 #include "AMDGPUReserveWWMRegs.h"
+#include "AMDGPUResourceUsageAnalysis.h"
 #include "AMDGPUSplitModule.h"
 #include "AMDGPUTargetObjectFile.h"
 #include "AMDGPUTargetTransformInfo.h"
@@ -553,7 +554,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
   initializeAMDGPUExternalAAWrapperPass(*PR);
   initializeAMDGPUImageIntrinsicOptimizerPass(*PR);
   initializeAMDGPUPrintfRuntimeBindingPass(*PR);
-  initializeAMDGPUResourceUsageAnalysisPass(*PR);
+  initializeAMDGPUResourceUsageAnalysisWrapperPassPass(*PR);
   initializeGCNNSAReassignLegacyPass(*PR);
   initializeGCNPreRAOptimizationsLegacyPass(*PR);
   initializeGCNPreRALongBranchRegLegacyPass(*PR);

>From f83c85af1ee0e0cb80ce8497e5ce60106ee0cd50 Mon Sep 17 00:00:00 2001
From: vikhegde <vikram.hegde at amd.com>
Date: Thu, 13 Mar 2025 13:06:42 +0530
Subject: [PATCH 2/3] modify constructor, use const reference

---
 llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def          | 2 +-
 llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp | 2 +-
 llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h   | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def b/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
index 00e5e08ee13d0..a04c47128c66b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPassRegistry.def
@@ -97,7 +97,7 @@ FUNCTION_PASS_WITH_PARAMS(
 #define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
 #endif
 
-MACHINE_FUNCTION_ANALYSIS("amdgpu-resource-usage", AMDGPUResourceUsageAnalysis(static_cast<const GCNTargetMachine *>(this)))
+MACHINE_FUNCTION_ANALYSIS("amdgpu-resource-usage", AMDGPUResourceUsageAnalysis(*static_cast<const GCNTargetMachine *>(this)))
 #undef MACHINE_FUNCTION_ANALYSIS
 
 #ifndef MACHINE_FUNCTION_PASS
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index ac251cd07a50a..46027b8890234 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -103,7 +103,7 @@ AnalysisKey AMDGPUResourceUsageAnalysis::Key;
 AMDGPUResourceUsageAnalysis::Result
 AMDGPUResourceUsageAnalysis::run(MachineFunction &MF,
                                  MachineFunctionAnalysisManager &MFAM) {
-  const MCSubtargetInfo &STI = *TM->getMCSubtargetInfo();
+  const MCSubtargetInfo &STI = *TM.getMCSubtargetInfo();
 
   // By default, for code object v5 and later, track only the minimum scratch
   // size
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
index 00b56889a8190..dcd8468c83a41 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
@@ -23,7 +23,7 @@ namespace llvm {
 
 class GCNSubtarget;
 class MachineFunction;
-class TargetMachine;
+class GCNTargetMachine;
 
 struct AMDGPUResourceUsageAnalysisImpl {
 public:
@@ -74,13 +74,13 @@ class AMDGPUResourceUsageAnalysis
   friend AnalysisInfoMixin<AMDGPUResourceUsageAnalysis>;
   static AnalysisKey Key;
 
-  const TargetMachine *TM;
+  const GCNTargetMachine &TM;
 
 public:
   using Result = AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo;
   Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM);
 
-  AMDGPUResourceUsageAnalysis(const TargetMachine *TM_) : TM(TM_) {}
+  AMDGPUResourceUsageAnalysis(const GCNTargetMachine &TM_) : TM(TM_) {}
 };
 
 } // namespace llvm

>From 1aee40e1c550a8512a28412ea3acd0e84e275f79 Mon Sep 17 00:00:00 2001
From: vikhegde <vikram.hegde at amd.com>
Date: Tue, 18 Mar 2025 12:01:22 +0530
Subject: [PATCH 3/3] avoid direct usage of AnalysisImpl scope

---
 llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp | 2 +-
 llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
index c1f88b559960f..fcbcfca71c723 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.cpp
@@ -164,7 +164,7 @@ void MCResourceInfo::assignResourceInfoExpr(
 
 void MCResourceInfo::gatherResourceInfo(
     const MachineFunction &MF,
-    const AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo &FRI,
+    const AMDGPUResourceUsageAnalysisWrapperPass::ResultT &FRI,
     MCContext &OutContext) {
   // Worst case VGPR use for non-hardware-entrypoints.
   MCSymbol *MaxVGPRSym = getMaxVGPRSymbol(OutContext);
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
index 19ee117074511..1e003c0cdcc2b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMCResourceInfo.h
@@ -90,10 +90,10 @@ class MCResourceInfo {
   /// transitive maximum or accumulative. For example, if A calls B and B's VGPR
   /// usage exceeds A's, A should be assigned B's VGPR usage. Furthermore,
   /// functions with indirect calls should be assigned the module level maximum.
-  void gatherResourceInfo(
-      const MachineFunction &MF,
-      const AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo &FRI,
-      MCContext &OutContext);
+  void
+  gatherResourceInfo(const MachineFunction &MF,
+                     const AMDGPUResourceUsageAnalysisWrapperPass::ResultT &FRI,
+                     MCContext &OutContext);
 
   const MCExpr *createTotalNumVGPRs(const MachineFunction &MF, MCContext &Ctx);
   const MCExpr *createTotalNumSGPRs(const MachineFunction &MF, bool hasXnack,



More information about the llvm-commits mailing list