Basic IPA optimizations based on profile.
Copyright (C) 2003-2024 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
ipa-profile pass implements the following analysis propagating profille
inter-procedurally.
- Count histogram construction. This is a histogram analyzing how much
time is spent executing statements with a given execution count read
from profile feedback. This histogram is complete only with LTO,
otherwise it contains information only about the current unit.
The information is used to set hot/cold thresholds.
- Next speculative indirect call resolution is performed: the local
profile pass assigns profile-id to each function and provide us with a
histogram specifying the most common target. We look up the callgraph
node corresponding to the target and produce a speculative call.
This call may or may not survive through IPA optimization based on decision
of inliner.
- Finally we propagate the following flags: unlikely executed, executed
once, executed at startup and executed at exit. These flags are used to
control code size/performance threshold and code placement (by producing
.text.unlikely/.text.hot/.text.startup/.text.exit subsections).
Entry in the histogram.