On 1 September 2011 11:16, Jakub Jelinek <[email protected]> wrote:
> On Thu, Sep 01, 2011 at 10:14:29AM +0200, Richard Guenther wrote:
>> On Thu, Sep 1, 2011 at 10:12 AM, Ira Rosen <[email protected]> wrote:
>> > When vectorizing a function call we replace the original call with a
>> > dummy statement to ensure that DCE later removes it. We also remove
>> > its stmt_vec_info, which causes the segfault when we try to access it
>> > through related pattern stmt. The following patch updates related
>> > pattern stmt to be the dummy stmt.
>> >
>> > Bootstrapped and tested on powerpc64-suse-linux.
>> > OK for 4.6?
>>
>> Ok.
>
> Please also commit the testcase into the trunk.
Tested on powerpc64-suse-linux.
Committed to trunk.
Ira
testsuite/ChangeLog:
PR tree-optimization/50178
* gfortran.dg/vect/pr50178.f90: New test.
Index: testsuite/gfortran.dg/vect/pr50178.f90
===================================================================
--- testsuite/gfortran.dg/vect/pr50178.f90 (revision 0)
+++ testsuite/gfortran.dg/vect/pr50178.f90 (revision 0)
@@ -0,0 +1,29 @@
+! { dg-do compile }
+
+module yemdyn
+ implicit none
+ integer, parameter :: jpim = selected_int_kind(9)
+ integer, parameter :: jprb = selected_real_kind(13,300)
+ real(kind=jprb) :: elx
+ real(kind=jprb), allocatable :: xkcoef(:)
+ integer(kind=jpim),allocatable :: ncpln(:), npne(:)
+end module yemdyn
+
+subroutine suedyn
+
+ use yemdyn
+
+ implicit none
+
+ integer(kind=jpim) :: jm, jn
+ real(kind=jprb) :: zjm, zjn, zxxx
+
+ jn=0
+ do jm=0,ncpln(jn)
+ zjm=real(jm,jprb) / elx
+ xkcoef(npne(jn)+jm) = - zxxx*(zjm**2)**0.5_jprb
+ end do
+
+end subroutine suedyn
+
+! { dg-final { cleanup-tree-dump "vect" } }
>
>> > PR tree-optimization/50178
>> > * tree-vect-stmts.c (vectorizable_call): Update the related
>> > pattern statement
>> > before deleting the original call.
>> > (vect_transform_stmt): Don't expect the related pattern statement
>> > match the
>> > original statement after transformation.
>> >
>> > testsuite/ChangeLog:
>> >
>> > PR tree-optimization/50178
>> > * gfortran.dg/vect/pr50178.f90: New test.
>
> Jakub
>