Extend BasicBlocksUtils to update MemorySSA.
The general idea appears to be good, do you have any testcases reflect the change?
Also correct me if I'm wrong, it seems changes to MergeBlockIntoPredecessor can be separated from other changes.
Thank you for the comments!
I don't have testcases just for this change.
There are a couple of dependent patches in Phabricator (e.g. D45301, D47022 need to be rebased) that will use these changes.
The use of MemorySSA is disabled by default, but the dependent patches will update tests with a target that enables the use of MemorySSA (e.g. see tests in D40375).
Yes, I think the changes to MergeBlockIntoPredecessor could be split, but the overall purpose of adding an additional analysis to update is the same and the scope of the changes is fairly small.
If you think it will help review or clarity, I can split this up.
I think just one patch is fine for this kind of API update.
If you want to test any of these changes, you can do so by writing a unittest, but we don't have an amazing track record here. See the *single* test we have in unittests/Transforms/Utils/BasicBlockUtils.cpp. While adding coverage there is good, if it proves hard to do or would require a bunch of work, I'm happy with relying on the usage in the subsequent patches.
The code LGTM. If you can't easily add a unittest, feel free to submit as-is. If you can add a test, I'm happy to look at that too.