As the state of lld gets more complicated, shutting down gets more expensive.
In a normal lld run we can just call _exit immediately after renaming the temporary output file. We still want the ability to run a full shutdown since that is useful for detecting memory leaks.
The attached patch adds a --full-shutdown flag and changes lit to use it.
The speedups I got were
master 7.230308488 patch 7.208082567 1.00308347203x faster
master 7.427749933 patch 7.418814415 1.00120444016x faster
master 5.205103172 patch 5.125736748 1.01548390561x faster
master 2.049300081 patch 1.969078119 1.04074087322x faster
the gold plugin
master 0.355730113 patch 0.349688155 1.01727813171x faster
master 0.600935753 patch 0.59087035 1.01703487576x faster
master 0.034656451 patch 0.034052431 1.01773794065x faster
the gold plugin fsds
master 0.386335917 patch 0.378535563 1.02060666094x faster
master 0.686066136 patch 0.672882627 1.01959258342x faster
master 0.032056437 patch 0.031330437 1.02317235473x faster
master 3.24018577 patch 3.232975627 1.00223018786x faster
This also makes sure we don't have to worry to much about the shutdown cost of future changes.