This patch contributes some more plumbing to the "removing debug intrinsics" design: specifically utility methods for converting from one format into another. As it stands, it's going to be possible for blocks to move between "dbg.value" format (intrinsics) and "DPValue" format (no intrinsics) as needs be. As a result, Modules / Functions / Blocks grow a Boolean flag to indicate which format they currently contain, and have helper methods to initiate transferring from one to the other.
There's no consideration for serialising the flag to textual IR or bitcode: this is purely an in-memory representation right now. There's a "validate" method added to blocks to check that the debug-info isn't obviously broken, this is a smoke test rather than something the Verifier needs to be rigorous about.
There are a few places where we scatter calls to set the "IsNewDbgInfoFormat" flag on block or function creation: normally the functions and blocks have the flag set when they're inserted into their parent, but in a few scenarios debug-info sensitive operations occur before that happens, therefore the flag has to be explicitly set on creation. This feels fairly dumb, but it's all in aid of migration/transition rather than a long term code decision.
The unit test added takes a function with dbg.values, converts it to the new DPValue form, and confirms that the layout of the data structures is as expected, and that we can convert back to exactly the same format.
I think this comment could be slightly misleading - the function appears to set the flag and change the block to the desired debug info format.