This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR36967, ICE with predictive commoning
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Jul 2008 17:41:55 +0200 (CEST)
- Subject: [PATCH] Fix PR36967, ICE with predictive commoning
We were looking at some SSA_NAME in too detail after freeing it.
The following makes sure we only test if it actually _is_ an SSA_NAME
(which is what trunk did before the tuples merge).
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2008-07-30 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36967
* tree-predcom.c (remove_stmt): Use gimple_assign_ssa_name_copy_p.
Release defs of statements we remove.
* gfortran.dg/pr36967.f: New testcase.
Index: gcc/tree-predcom.c
===================================================================
*** gcc/tree-predcom.c (revision 138296)
--- gcc/tree-predcom.c (working copy)
*************** remove_stmt (gimple stmt)
*** 1707,1713 ****
remove_phi_node (&psi, true);
if (!next
! || !gimple_assign_copy_p (next)
|| gimple_assign_rhs1 (next) != name)
return;
--- 1707,1713 ----
remove_phi_node (&psi, true);
if (!next
! || !gimple_assign_ssa_name_copy_p (next)
|| gimple_assign_rhs1 (next) != name)
return;
*************** remove_stmt (gimple stmt)
*** 1727,1735 ****
mark_virtual_ops_for_renaming (stmt);
gsi_remove (&bsi, true);
if (!next
! || !gimple_assign_copy_p (next)
|| gimple_assign_rhs1 (next) != name)
return;
--- 1727,1736 ----
mark_virtual_ops_for_renaming (stmt);
gsi_remove (&bsi, true);
+ release_defs (stmt);
if (!next
! || !gimple_assign_ssa_name_copy_p (next)
|| gimple_assign_rhs1 (next) != name)
return;
Index: gcc/testsuite/gfortran.dg/pr36967.f
===================================================================
*** gcc/testsuite/gfortran.dg/pr36967.f (revision 0)
--- gcc/testsuite/gfortran.dg/pr36967.f (revision 0)
***************
*** 0 ****
--- 1,25 ----
+ ! { dg-options "-O2 -fpredictive-commoning" }
+ subroutine foo(x,y,n)
+ integer n
+ real*8 y(n,n,n),x(n,n,n)
+ integer k, j, i
+ do k = 2, n-1
+ do j = 2, n-1
+ do I = 2, n-1
+ y(i,j,k) = y(i,j,k)
+ + + (x(i-1,j-1,k)
+ + + x(i,j-1,k-1)
+ + + x(i,j+1,k-1)
+ + + x(i,j+1,k+1)
+ + + x(i+1,j,k+1))
+ + + (x(i-1,j-1,k-1)
+ + + x(i+1,j-1,k-1)
+ + + x(i-1,j+1,k-1)
+ + + x(i+1,j+1,k-1)
+ + + x(i-1,j+1,k+1)
+ + + x(i+1,j+1,k+1))
+ enddo
+ enddo
+ enddo
+ return
+ end