Bug 27466 - [dwz] Improve heuristics for odr
Summary: [dwz] Improve heuristics for odr
Status: NEW
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Nobody
Depends on:
Reported: 2021-02-25 14:10 UTC by Tom de Vries
Modified: 2021-02-25 14:10 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
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.