[llvm] [NewPM][CodeGen] Add `FunctionToMachineFunctionAnalysis` (PR #88610)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 10:47:11 PDT 2024
================
@@ -15,8 +16,7 @@ using namespace llvm;
PreservedAnalyses
FreeMachineFunctionPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) {
- auto &MMI = MF.getMMI();
- MFAM.invalidate(MF, PreservedAnalyses::none());
- MMI.deleteMachineFunctionFor(MF.getFunction()); // MF is dangling now.
- return PreservedAnalyses::none();
+ PreservedAnalyses PA = PreservedAnalyses::none();
----------------
aeubanks wrote:
we should not be invalidating function analyses from a machine function pass. this should be a function pass. so the pipeline should be something like `module(function(some-codegen-ir-passes,machine-function(isel,some-codegen-mir-passes),invalidate<machine-function>))`. and if we have a machine pass in the middle of the codegen pipeline, `module(function(some-codegen-ir-passes,machine-function(isel,some-codegen-mir-passes)),some-module-pass,function(machine-function(some-more-codegen-mir-passes),invalidate<machine-function>)`.
now that I think about it, we should just get rid of the module -> machine function adaptor and always go through a function -> machine function adaptor so that we can add an `invalidate<machine-function>` pass at the end if necessary. having two different adaptors that allow running machine function passes seems somewhat redundant anyway, and we definitely have to have the function -> machine function adaptor because we want to run function passes on a function, then mir passes on the same function before moving to the next function.
https://github.com/llvm/llvm-project/pull/88610
More information about the llvm-commits
mailing list