Cloning MachineFunction

Hi,

To me it seems that we should have some means to clone machine functions. As far as I can see there currently is none.

Such functionality would be required if/when trying to do MIR reduction ([llvm-dev] llvm-reduce for MIR (google.com)) and I am sure that there could be other uses as well if it was indeed available.

I know the question of cloning machine functions have been brought up before in [llvm-dev] Cloning MachineFunctions (google.com) and that Intel have done something along these lines as suggested in 2019 EuroLLVM Developers’ Meeting: L. Saba “Swinging Modulo Scheduling together with Register …” - YouTube

Does anyone else see that a cloneMF() could be useful to have in-tree?

-Markus