1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[AMDGPU] Fix running ResourceUsageAnalysis

Clear the map when running the analysis multiple times.
The assertion that should ensure that every function is only
analyzed once triggered sometimes (once every ~70 compiles of some
graphics pipelines) when two functions of subsequent runs were allocated
at the same address.

Differential Revision: https://reviews.llvm.org/D106452
This commit is contained in:
Sebastian Neubauer 2021-07-21 19:14:12 +02:00 committed by Sebastian Neubauer
parent 5995d46a94
commit 0e5d17756d

View File

@ -51,13 +51,21 @@ public:
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: