]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/114855 - speed up dom_oracle::register_transitives
authorRichard Biener <rguenther@suse.de>
Wed, 25 Sep 2024 08:38:12 +0000 (10:38 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 26 Sep 2024 12:26:00 +0000 (14:26 +0200)
commit942bbb2357656019caa3f8ebd2d23b09222f039a
treea3000ab35cc965395091bebdc37c3bcb13bc4650
parente4a58b6f28383cb40e4fa287cc7dad43bafb85b2
tree-optimization/114855 - speed up dom_oracle::register_transitives

dom_oracle::register_transitives contains an unbound dominator walk
which for the testcase in PR114855 dominates the profile.  The following
fixes the unbound work done by assigning a constant work budget to the
loop, bounding the number of dominators visited but also the number of
relations processed.  This gets both dom_oracle::register_transitives and
get_immediate_dominator off the profile.

I'll note that we're still doing an unbound dominator walk via
equiv_set in find_equiv_dom at the start of the function and when
we register a relation that also looks up the same way.  At least
for the testcase at hand this isn't an issue.

I've also amended the guard to register_transitives with the
per-basic-block limit for the number of relations registered not
being exhausted.

PR tree-optimization/114855
* params.opt (--param transitive-relations-work-bound): New.
* doc/invoke.texi (--param transitive-relations-work-bound):
Document.
* value-relation.cc (dom_oracle::register_transitives):
Assing an overall work budget, bounding the dominator walk and
the number of relations processed.
(dom_oracle::record): Only register_transitives when the
number of already registered relations does not yet exceed
the per-BB limit.
gcc/doc/invoke.texi
gcc/params.opt
gcc/value-relation.cc