Using the pointer type analysis we can re-constitute typed pointers and
populate the correct types in the bitcasts throughout the IR.
This doesn't yet handle all cases, but this should be illustrative as to the dirction and feasability of
the solution.
Can you explain why PrefixType is needed? It seems like a strange wart in the API.
If this is really necessary, I feel like a cleaner API for the ValueEnumerator itself would be to split the enumeration out of the constructor, so that it's used as (not sure where ShouldPreserveUseListOrder should go):
You could then inject an EnumerateType in the DirectX backend. There may have to be a Finalize method that must be called exactly once.
I haven't thought about how that change would propagate through the BitCodeModuleWriter.