[llvm] A MMIWP Constructor Initialized with the move constructor of MMI (PR #98770)
Matin Raayai via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 07:56:18 PDT 2024
matinraayai wrote:
@arsenm thanks for making a PR for removing the MMI reference; Let me know when it is merged so that I can test it with this PR.
However, I think there might be more issues with this than just a set of stale references. While trying the code example I put [here](https://github.com/llvm/llvm-project/pull/98770#issue-2407150383) in my tool code, I noticed that the MF states get corrupted once the PM operating on its original MMI goes out of scope. For this PR to merge I think I need to clarify whether **an MMI should be moved at all.** If we treat MMI as a "Module but for MIR" then probably not. If we treat it simply just as an MIR analysis data structure, then a move operator might be very useful.
**If an MMI can be moved, then the constructor needs to be tested**. We can do this by forcing the old MMI/PM out of scope and then checking its internal content. That's how I noticed the stale reference issues in the first place.
On the other hand, **if an MMI cannot be moved, then it might be best if MMIWP doesn't own its MMI**. I think MMIWP should also behave like the new PM `MachineModuleAnalysis`, where the MMI must be externally supplied to the pass.
I'm happy to move this PR in either direction, given I understand which direction is deemed appropriate by the backend maintainers.
https://github.com/llvm/llvm-project/pull/98770
More information about the llvm-commits
mailing list