rtl-optimization/104686 - speedup IRA allocno conflict test
authorRichard Biener <rguenther@suse.de>
Wed, 2 Mar 2022 07:55:58 +0000 (08:55 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 2 Mar 2022 14:08:49 +0000 (15:08 +0100)
commit8fede2876a751d53a28442dcca32466daa929daa
tree09c5198e8f99f04d4eb9e23c4378ea4603f7d3e3
parentced22c51baaa3fe84d14d5baef60c4440a35b4be
rtl-optimization/104686 - speedup IRA allocno conflict test

In this PR allocnos_conflict_p takes 90% of the compile-time via
the calls from update_conflict_hard_regno_costs.  This is due to
the high number of conflicts recorded in the dense bitvector
representation.  Fortunately we can take advantage of the bitvector
representation here and turn the O(n) conflict test into an O(1) one,
greatly speeding up the compile of the testcase from 39s to just 4s
(93% IRA time to 26% IRA time).

While for the testcase in question the first allocno is almost always
the nice one the patch tries a more systematic approach to finding
the allocno to iterate object conflicts over.  That does reduce
the actual number of compares for the testcase but it doesn't make
a measurable difference wall-clock wise.  That's not guaranteed
though I think so I've kept this systematic way of choosing the
cheapest allocno.

2022-03-02  Richard Biener  <rguenther@suse.de>

PR rtl-optimization/104686
* ira-color.cc (object_conflicts_with_allocno_p): New function
using a bitvector test instead of iterating when possible.
(allocnos_conflict_p): Choose the best allocno to iterate over
object conflicts.
(update_conflict_hard_regno_costs): Do allocnos_conflict_p test
last.
gcc/ira-color.cc