]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add --param max-devirt-targets
authorJan Hubicka <jh@suse.cz>
Sat, 20 Sep 2025 13:11:50 +0000 (15:11 +0200)
committerJan Hubicka <jh@suse.cz>
Sat, 20 Sep 2025 13:12:26 +0000 (15:12 +0200)
commit9ee937b2f92a930eb5407260a56e5fe0fa137e85
tree2815563d0b3a2820030b9ef3d6edf97ae69cbf66
parent3eca9b5119f235666a2d97cb77a6cddc567bbe8b
Add --param max-devirt-targets

Currently we speculatively devirtualize using static analysis (with no profile
feedback) only when there is one possible target found.  With profile feedback
we support multiple targets which seems useful in some scenarios.

This patch adds --param max-devirt-targets which enables devirtualization up to
given number of targets and defaults it to 3.  This happens i.e. in spec2017
omnetpp, though the devirtualizaton is later undone by inliner since it is not
considered useful.  The patch still seems to improve omnetpp by 2% in some
setups.

Other advantage of the patch is that the multi-target devirtualizatoin gets
tested without profile feedback so we more likely notice problems with it.

gcc/ChangeLog:

* doc/invoke.texi (--param max-devirt-targets) Document.
* ipa-devirt.cc (ipa_devirt): Implement muti-target
devirtualization.
* params.opt (max-devirt-targets): New parameter.

gcc/testsuite/ChangeLog:

* g++.dg/ipa/devirt-2.C: Update template.
* g++.dg/ipa/devirt-42.C: Update template.
* g++.dg/lto/devirt-2_0.C: Update template.
gcc/doc/invoke.texi
gcc/ipa-devirt.cc
gcc/params.opt
gcc/testsuite/g++.dg/ipa/devirt-2.C
gcc/testsuite/g++.dg/ipa/devirt-42.C
gcc/testsuite/g++.dg/lto/devirt-2_0.C