This is an issue both with regular and Thin LTO. When we link together
a DICompileUnit that is marked NoDebug (e.g when compiling with -g0
but applying an AutoFDO profile, which requires location tracking
in the compiler) and a DICompileUnit with debug emission enabled,
we can have failures during dwarf debug generation. Specifically,
when we have inlined from the NoDebug compile unit into the debug
compile unit, we can fail during construction of the abstract and
inlined scope DIEs. This is because the SPMap does not include NoDebug
CUs (they are skipped in the debug_compile_units_iterator).
This patch fixes the failures by skipping SPs from NoDebug CUs when
generating these DIEs. I am not sure if this is the right fix from
the debug generation standpoint, however. I don't know if we should
instead either upgrade NoDebug CU on link with a debug CU, or enable
adding these NoDebug CUs into the SPMap.