mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 02:46:08 +00:00

The GlobalResolutions map was found to contribute ~9% of the peak memory of a large thin link. However, we are essentially done with it when we are about to compute cross module imports, which itself adds to the peak memory due to the import and export lists (there is one use just after importing but it can easily be moved before importing). Move the last use up above importing, and free the GlobalResolutions map after that (and before importing). To help guard against future inadvertent use after it has been released, change it to a std::optional.