Storing temporary data in Function / MachineFunction

Hello LLVM-Dev,

Recently I had discussion on a patch related to IPRA.
IPRA uses immutable pass to store map of Function → updated regmask collected by RegUsageInfoCollector pass. However this is just a 32bit int value so it seems that we can store it in MachineFucntion it self .
but IIRC Hal, Mehdi and I thought that as updated regmask is an analysis result used by IPRA so store such information in MachineFunction is not good idea.

I think there was an idea floating to have scratch/temp field in Function/ MachineFucntion which can store temporary data and data will be valid upto some other pass and such fresh data can be used by other pass. For example marking functions eligible for certain optimization , marking vritual register to be selected/rejected for some analysis etc.
It seems if such enhancement is done it will be useful in IPRA case and we can remove immutable pass to store analysis.

Are there any other such use cases observed?
If there are enough usecases I would like to implement this enhancements.
Any comments?