[llvm] [NewPM][CodeGen] Add `MachineFunctionAnalysis` (PR #88610)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 03:53:02 PDT 2025
optimisan wrote:
Having the `InvalidateAnalysisPass<MachineFunctionAnalysis>()` is causing a problem with `ModuleToCGSCCPassAdaptor` (MtoCGPA) by deleting machine functions for other functions and ending up with empty compiled functions.
This is because `ModuleToCGSCCPAdaptor` propagates `PassPA` (received from the `CGSCCToFunctionPassAdaptor` that runs the actual codegen pipeline on MFs) to the next SCC. That causes `MFA` invalidation on functions in the next SCC.
For us, `PassPA` happens to be returned from `invalidate<machine-function-analysis>` which `abandons` the `MachineFunctionAnalysis`. So while the first function runs through the pipeline normally, `invalidate` also deletes the functions in the next SCC before its pipeline is run. (this seems to be the intended mechanism of the `CG adaptor` to allow cross-SCC invalidations.
---
The most obvious solution is to stop using the invalidation framework to free machine functions. This would mean we have to store MFs out of the FAM.
I'm still not a 100% sure of how the ModuleToCGSCCPassAdaptor invalidation mechanism is handling this, so there could be a better way to deal with this, what do you think?
@aeubanks @paperchalice
https://github.com/llvm/llvm-project/pull/88610
More information about the llvm-commits
mailing list