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
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: