More delicate task than updating control flow graph is to update profile. Many
of the function to modify flow graph, like redirect_edge_and_branch
do
not have enough information to easily update profile, so updating profile is
in majority cases left on the caller. Since it is difficult to discover bugs in
the profile updating code, as they manifest themselves only by producing worse
code and checking profile consistency is not possible, because of numeric
error accumulation, special care needs to be taken into this issue.
It is important to point out, that REG_BR_PROB_BASE
and
BB_FREQ_BASE
are both set low enough to be possible to compute second
power of any frequency or probability in the flow graph, it is not possible to
even square the count
field, as modern CPUs are fast enough to execute
operations quickly.