This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] Support "stored once" optimization for different types
ClosedPublic

Authored by nikic on Jan 11 2022, 9:36 AM.

Details

Summary

GlobalOpt can optimize a global with undef initializer and a single store to put the stored value into the initializer instead. Currently, this requires the type of the global and the store to match.

This patch extends support to cases with different types (but same size), in which case we create a new global to replace the old one.

Diff Detail