[PATCH] D106452: [AMDGPU] Fix running ResourceUsageAnalysis

Sebastian Neubauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 07:12:28 PDT 2021


sebastian-ne updated this revision to Diff 360802.
sebastian-ne added a comment.

The previous fix here was actually wrong (and failed lit tests), resetting the map should be done in doInitialization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106452

Files:
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h


Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
@@ -51,13 +51,21 @@
 
   bool runOnSCC(CallGraphSCC &SCC) override;
 
+  bool doInitialization(CallGraph &CG) override {
+    CallGraphResourceInfo.clear();
+    return CallGraphSCCPass::doInitialization(CG);
+  }
+
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.addRequired<MachineModuleInfoWrapperPass>();
     AU.setPreservesAll();
   }
 
   const SIFunctionResourceInfo &getResourceInfo(const Function *F) const {
-    return CallGraphResourceInfo.find(F)->getSecond();
+    auto Info = CallGraphResourceInfo.find(F);
+    assert(Info != CallGraphResourceInfo.end() &&
+           "Failed to find resource info for function");
+    return Info->getSecond();
   }
 
 private:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106452.360802.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210722/f50d30dd/attachment.bin>


More information about the llvm-commits mailing list