Skip to content

Commit

Permalink
Call reorder_dups ASAP instead of ALAP
Browse files Browse the repository at this point in the history
Currently, we call reorder_dups ALAP, just before copy_die_tree, and only for
DIEs that will be copied.

This approach causes a problem with reachable DIE propagation (which is done
in partition_dups after phase 1): when a dup-chain that needs to be reordered
(starts with ODR_DECL but also contains ODR_DEF) is marked as reachable during
this propagation, propagation will stop at the ODR_DECL, while it should
continue at the first ODR_DEF instead.

Fix this by calling reorder_dups ASAP, just after computing the partitions.

2020-01-21  Tom de Vries  <tdevries@suse.de>

	PR dwz/25424
	* dwz.c (partition_dups_2): Move calling of reorder_dups ...
	(partition_dups): ... here.
  • Loading branch information
vries committed Feb 24, 2021
1 parent 56e2374 commit e523774
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions dwz.c
Expand Up @@ -8140,13 +8140,6 @@ partition_dups_2 (dw_die_ref *arr, size_t i, size_t j, size_t cnt,

if (force)
{
if (odr_active_p && odr_mode != ODR_BASIC)
for (k = i; k < j; k++)
{
if (second_phase && !arr[k]->die_ref_seen)
continue;
arr[k] = reorder_dups (arr[k]);
}
dw_die_ref die, *diep;
dw_cu_ref refcu = die_cu (arr[i]);
dw_cu_ref partial_cu = pool_alloc (dw_cu, sizeof (struct dw_cu));
Expand Down Expand Up @@ -8502,6 +8495,9 @@ partition_dups (void)
if (stats_p)
stats->part_cnt += nr_partitions;

if (odr && odr_mode != ODR_BASIC)
for (i = 0; i < vec_size; ++i)
arr[i] = reorder_dups (arr[i]);
if (partition_dups_1 (arr, nr_partitions, partitions, &first_partial_cu,
&last_partial_cu, false))
{
Expand Down

0 comments on commit e523774

Please sign in to comment.