The existing code goes to some length to try to use the type of the malloc. However, allocation returns *storage* and LLVM's memory model doesn't included typed memory. As a result, this seems to simply discard cases we can easily handle. I see no strong reason to prefer a global of one type over another.
As a side effect, we can delete a bunch of complicated code.
This seems too easy. A skeptical second set of eyes is appreciated. Am I missing something?