The malloc to global transform currently determines the type of the global by looking at bitcasts of the malloc. This is limited (the transform fails if there are multiple different types) and incompatible with opaque pointers.
My initial approach was to construct an appropriate struct type based on usage in loads/stores (and I can go back to that if desired). What this patch does instead is to always create an [i8 x AllocSize] global, without trying to guess types at all.
This does mean that other transforms that require a certain global type may break. I fixed one such case in D117034, which is the only one that came up in tests. From a philosophical perspective, I think that fixing transforms to not depend on global type is generally preferable.
clang-format: please reformat the code