This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Supefluous phi removal
Hello,
> + if (TREE_CODE (stmt) != PHI_NODE
> + /* Prevent copy propagation into arguments of phi nodes
> + corresponding to abnormal edges, by setting their
> + value to top. */
> + || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
> + {
> + eq_to[aver] = t;
> + raise_value (phi, t, eq_to);
>
>
> So what's not terribly obvious is that the assignment to eq_to here is
> preventing copy propagation of the PHI argument, but that the PHI result
> is still eligible for copy propagation.
>
> Instead I would write something like this
>
> /* Prevent copy propagation of SSA_NAMES which occur in abnormal PHI
> nodes. */
> if (SSA_NAME_OCCURS_IN_ABORMAL_PHI (t))
> eq_to[aver] = t;
>
> /* Raise the result of PHI by joining it to T. */
> raise_value (phi, t, eq_to);
>
> It seems to me that you always want to call raise_value, regardless of
> whether or not T is set from a normal statement or a PHI node.
no -- if it is a normal phi node, it either has assigned value of
bottom, or raise_value was called for it already recursively, so there
is no point in calling raise_value for it again.
We must only call raise_value if we need to change value for the ssa
name from some reason, which may be because
-- the ssa name is defined in the real statement
-- we cannot replace its uses (in our case this only happens when it is an
argument on abnormal edge)
-- value of some argument of the phi node it is defined in has changed
Zdenek