Skip to content

Conversation

paperchalice
Copy link
Contributor

Add FunctionToMachineFunctionPassAdaptor, currently codegen pipeline has the pattern module->function->machine-function if MachineOutlinerPass is not enabled. This adaptor allows FreeMachineFunction to be a function pass, then we don't need to handle function analyses invalidation in MachinePassManager etc.
Stacked on #88610.
Issue: #84397.

@paperchalice paperchalice requested review from aeubanks and arsenm April 15, 2024 10:49
//
// Once function changed by a non-trivial pass, we need to do instruction
// selection again.
auto PAC = PA.getChecker<FunctionAnalysisManagerModuleProxy>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const &?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a PreservedAnalysisChecker, so it's fine as is

Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test using this in llvm/unittests/CodeGen/PassManagerTest.cpp?

//
// Once function changed by a non-trivial pass, we need to do instruction
// selection again.
auto PAC = PA.getChecker<FunctionAnalysisManagerModuleProxy>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a PreservedAnalysisChecker, so it's fine as is

// If this proxy isn't marked as preserved, then even if the result remains
// valid, the key itself may no longer be valid, so we clear everything.
//
// Once function changed by a non-trivial pass, we need to do instruction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something that actually happens? I thought once we're done with codegen, we're basically done with the IR as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never happened, MachineOutliner just only create dummy IR functions to get associated machine functions.

@paperchalice paperchalice force-pushed the adaptor branch 2 times, most recently from b6058e0 to e404d6d Compare April 16, 2024 07:00
// Clear out the analysis manager if we're being destroyed -- it means we
// didn't even see an invalidate call when we got invalidated.
FAM->clear();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes destruction issue when destruct analysis managers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants