Follow on to D42816 which dropped declarations of dead symbols. With
this change we also drop declarations which were never defined in this
module, but which are also unused after dead symbols are removed. These
symbols may or may not be dead in their defining modules.
Removing the unused declarations will prevent indirect call promotion in
the ThinLTO Backend from adding a new reference to a symbol, which can
result in linker unsats if that symbol was in fact dead and therefore
removed in its defining module. This can happen when we compile with a
sample profile collected from one binary but used for another, which may
have profiled targets that aren't used in the new binary.
Some test changes occur as a result (for whole program devirtualization,
we end up with a cast if there is no declaration in the module, for ICP
tests we may need to add a direct call to keep the declaration around).