This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] for PR 23817
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 12 Sep 2005 11:32:50 +0200
- Subject: [patch] for PR 23817
Hello,
copy propagation in tree_merge_blocks may break loop closed ssa form.
This is not that much of a problem, since it only happens when loop
structures are modified -- otherwise it is impossible to merge blocks
from different loops. The problem is that consequent loop closed ssa
form update won't find the uses that need to be updated, as it only
looks in blocks whose loop has changed. So we need to prevent copy
propagation and turn the phi node into assignment in this case (the
loop of the merged block must necessarily change, therefore this
ensures that lcssa is updated).
Bootstrapped & regtested on i686.
Zdenek
PR tree-optimize/23817
* tree-cfg.c (tree_merge_blocks): Preserve loop closed ssa.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.220
diff -c -3 -p -r2.220 tree-cfg.c
*** tree-cfg.c 9 Sep 2005 16:17:24 -0000 2.220
--- tree-cfg.c 12 Sep 2005 09:30:27 -0000
*************** tree_merge_blocks (basic_block a, basic_
*** 1314,1321 ****
{
tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
tree copy;
!
! if (!may_propagate_copy (def, use))
{
gcc_assert (is_gimple_reg (def));
--- 1314,1330 ----
{
tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
tree copy;
! bool may_replace_uses = may_propagate_copy (def, use);
!
! /* In case we have loops to care about, do not propagate arguments of
! loop closed ssa phi nodes. */
! if (current_loops
! && is_gimple_reg (def)
! && TREE_CODE (use) == SSA_NAME
! && a->loop_father != b->loop_father)
! may_replace_uses = false;
!
! if (!may_replace_uses)
{
gcc_assert (is_gimple_reg (def));