This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] Generalize malloc-to-global transformation by discarding type
AbandonedPublic

Authored by reames on Jan 13 2022, 1:38 PM.

Details

Summary

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?

Diff Detail