https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589
--- Comment #14 from kugan.vivekanandarajah at linaro dot org --- On 16/02/16 02:02, jamborm at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589 > > --- Comment #13 from Martin Jambor <jamborm at gcc dot gnu.org> --- > (In reply to kugan from comment #11) >> In remove_unreachable_nodes, just before ipa-cp, this node becomes local >> (address taken is false and local.local = true). After that, when >> ipa_propagate_frequency is run, which updates the frequency to zero. I think >> we should check the frequency at this point in time and remove such nodes. > > If remove_unreachable_nodes keeps the node around for comdat reasons, > we cannot remove it just because it has zero estimated frequency > (unless remove_unreachable_nodes was wrong and should have removed the > node itself). > > I think that remove_unreachable_nodes should either remove the node, > or not set it to local (or set something like force_output or > forced_by_abi, if it is some really weird case). Thanks for the comment. It looks to me that it is already done. /* If any symbol in a comdat group is reachable, force all externally visible symbols in the same comdat group to be reachable as well. Comdat-local symbols can be discarded if all uses were inlined. */ The problem seems to be that, for the reduced test case, at the point when the node becomes local, frequency = 2. After ipa_propagate_frequency is run, frequency becomes zero. I dont think that this case is handled now. Maybe we should change the removal pas as : + for (unsigned int i = 0; i < new_locals.length (); ++i) + { + if (!new_locals[i]->frequency) + { + node = new_locals[i]; + if (!node->aux) + { + if (file) + fprintf (file, " %s/%i", node->name (), node->order); + node->remove (); + changed = true; + } + } + } Thanks, Kugan