In situations when a submodule is extracted from big module (i.e. using
CloneModule) a lot of debug info is copied via metadata nodes. Despite of
the fact that part of that info is not linked to any instruction in extracted
IR file, StripDeadDebugInfo pass doesn't drop them.
Strengthen criteria for debug info that should be kept in a module:
- Only those compile units are left that referenced by a subprogram debug info
node that is attached to a function definition in the module or to an instruction
in the module that belongs to an inlined function.
- Compile units are not left explicitly if they have const global expression.
They should be left if that const global is used in a function that is contained
in extracted module.
Signed-off-by: Mikhail Lychkov <firstname.lastname@example.org>