Skip to content

Commit

Permalink
rtl-optimization/110587 - speedup find_hard_regno_for_1
Browse files Browse the repository at this point in the history
The following applies a micro-optimization to find_hard_regno_for_1,
re-ordering the check so we can easily jump-thread by using an else.
This reduces the time spent in this function by 15% for the testcase
in the PR.

Bootstrap & regtest running on x86_64-unknown-linux-gnu, OK if that
passes?

Thanks,
Richard.

	PR rtl-optimization/110587
	* lra-assigns.cc (find_hard_regno_for_1): Re-order checks.
  • Loading branch information
rguenth authored and ouuleilei-bot committed Jul 25, 2023
1 parent c2d62cd commit 1cf2912
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gcc/lra-assigns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,15 @@ find_hard_regno_for_1 (int regno, int *cost, int try_only_hard_regno,
r2 != NULL;
r2 = r2->start_next)
{
if (r2->regno >= lra_constraint_new_regno_start
if (live_pseudos_reg_renumber[r2->regno] < 0
&& r2->regno >= lra_constraint_new_regno_start
&& lra_reg_info[r2->regno].preferred_hard_regno1 >= 0
&& live_pseudos_reg_renumber[r2->regno] < 0
&& rclass_intersect_p[regno_allocno_class_array[r2->regno]])
sparseset_set_bit (conflict_reload_and_inheritance_pseudos,
r2->regno);
if (live_pseudos_reg_renumber[r2->regno] >= 0
&& rclass_intersect_p[regno_allocno_class_array[r2->regno]])
else if (live_pseudos_reg_renumber[r2->regno] >= 0
&& rclass_intersect_p
[regno_allocno_class_array[r2->regno]])
sparseset_set_bit (live_range_hard_reg_pseudos, r2->regno);
}
}
Expand Down

0 comments on commit 1cf2912

Please sign in to comment.