diff options
author | Richard Biener <rguenther@suse.de> | 2023-07-25 15:36:30 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-08-09 08:46:58 +0200 |
commit | b66e613a1a8d5b8fc9d8b03f7b60260700acf833 (patch) | |
tree | df8e289d66738028385fbc9c82906d02778900d6 | |
parent | 0412f0e374de1f66e20c407e0b519324af3fd5b6 (diff) | |
download | gcc-b66e613a1a8d5b8fc9d8b03f7b60260700acf833.zip gcc-b66e613a1a8d5b8fc9d8b03f7b60260700acf833.tar.gz gcc-b66e613a1a8d5b8fc9d8b03f7b60260700acf833.tar.bz2 |
rtl-optimization/110587 - speedup find_hard_regno_for_1
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.
PR rtl-optimization/110587
* lra-assigns.cc (find_hard_regno_for_1): Re-order checks.
-rw-r--r-- | gcc/lra-assigns.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/lra-assigns.cc b/gcc/lra-assigns.cc index b8582dc..d2ebcfd 100644 --- a/gcc/lra-assigns.cc +++ b/gcc/lra-assigns.cc @@ -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); } } |