This reverts #46722, commit e0ab5d5feb. Since #111167, commit 10b69dde3f, we are generating DWARF subprograms in a way that is meant to be more compatible with LLVM's expectations, so hopefully we don't need this workaround rewriting CUs anymore.
e0ab5d5feb
10b69dde3f