https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104377
--- Comment #1 from Feng Xue <fxue at os dot amperecomputing.com> ---
(In reply to Feng Xue from comment #0)
> For function create_specialized_node(), the "node" to operated on seems
> always to be an original cgraph node, never a clone node. From call graph
> related to the function, we know that ipcp_decision_stage () only passes raw
> cgraph node downwards to its callees. Then, "node" reaching
> create_specialized_node() would not be a clone, so the code enclosed by "if
> (old_adjustments)" might be of no use. But I am not sure sure if there is
> some thing that I missed.
>
> ipcp_driver
> |
> '--> ipcp_decision_stage
> |
> '--> decide_whether_version_node
> |
> |--> decide_about_value
> | |
> '-----'--> create_specialized_node
OK. I does missed something. Here we could not hold assumption that
ipcp_decision_stage() only sees raw cgraph node, since sometime in the future
some new ipa pass may be added prior to ipa-cp, and this pass introduces clone
node.
However, there is a questionable point about the code snippet
if (!node->can_change_signature
|| old_adj->op != IPA_PARAM_OP_COPY
|| (!known_csts[old_adj->base_index]
&& ipa_is_param_used (info, old_adj->base_index)))
In ipa-cp, known_csts is for the node, has no relation to the node's origin
node, but here it is accessed via index of the latter (old_adj->base_index),
will this cause out-of-bound error?