Fix handling of goto locuses and phi args in auto-profile
afdo_set_bb_count had code that, only if no count was determined in the BB itself,
looked into its outgoing edges and tried to determine counts based on location of
phi args. This is not quite correct, since value detemrined is the count of edge
which may be lower than count of BB.
This patchs moves the logic into afdo_unscaled_edge_count and extends it to
also use goto_locus. BB profile is infered only if BB has single successor and
otherwise the edge counts are stored into correct location in
afdo_calculate_branch_prob.
gcc/ChangeLog:
* auto-profile.cc (afdo_unscaled_edge_count): New function based on
part of ...
(afdo_set_bb_count): ... this function; use it here.
(afdo_calculate_branch_prob): Try to determine edge counts using
phi args and goto locuses.