Bug 27466

Summary: [dwz] Improve heuristics for odr
Product: dwz Reporter: Tom de Vries <vries>
Component: defaultAssignee: Nobody <nobody>
Status: NEW ---    
Severity: enhancement CC: dwz
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Tom de Vries 2021-02-25 14:10:30 UTC
In partition_dups_1, we use heuristics to decide whether to convert a partition into a partial unit.
These heuristics use the number of unique referrer CUs, registered in the cnt variable.

This cnt is used to compute both:
- the current size of the partition:
  "orig_size = size * cnt;" 
- to size of imports of partial unit to be created:
  "+ (part_lang != 0 ? 0 : import_size * cnt)".

With odr, the duplicate chain is no longer isomorph, and consequently orig_size cannot any longer be calculated using size * cnt.

Then, the number of unique referrer CUs is the correct number to use for the number of imports.  But due to recent commit "Fix DW_AT_decl_file for odr
", the cnt variable may be lower than the actual number of unique referrer CUs.