--- /dev/null
+! PR tree-optimization/65450
+! { dg-do run }
+! { dg-additional-options "-mtune=amdfam10" { target x86_64-*-* i?86-*-* } }
+
+program pr65450
+ integer :: n, m, o, i, k
+ double precision :: u(500,60,3), h(500,60,3)
+ double precision :: v(500,60)
+ u = 0
+ h = 0
+ o = 1
+ m = 2
+ n = 3
+ do k = 1, 50
+ v = foo (u(:,:,m))
+ u(2:499,1:60,n) = u(2:499,1:60,o)+16.d0
+ h(1:500,2:59,n) = h(1:500,2:59,o)-4.d0*v(1:500,2:59)-32.0d0
+ i = o
+ o = m
+ m = n
+ n = i
+ end do
+ if (abs (v(17, 23) + h(17, 23, 2) + 768.0d0) > 0.5d0) call abort
+contains
+ function foo(a)
+ double precision :: a(:,:)
+ double precision :: foo(size(a,dim=1),size(a,dim=2))
+ integer :: i, j
+ i = size(a,dim=1)
+ j = size(a,dim=2)
+ foo(2:i-1,1:j) = a(3:i,1:j)-a(1:i-2,1:j)
+ foo(1,1:j) = 2*(a(2,1:j)-a(1,1:j))
+ foo(i,1:j) = 2*(a(i,1:j)-a(i-1,1:j))
+ end function foo
+end program pr65450
return new_vect_var;
}
+/* Duplicate ptr info and set alignment/misaligment on NAME from DR. */
+
+static void
+vect_duplicate_ssa_name_ptr_info (tree name, data_reference *dr,
+ stmt_vec_info stmt_info)
+{
+ duplicate_ssa_name_ptr_info (name, DR_PTR_INFO (dr));
+ unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
+ int misalign = DR_MISALIGNMENT (dr);
+ if (misalign == -1)
+ mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
+ else
+ set_ptr_info_alignment (SSA_NAME_PTR_INFO (name), align, misalign);
+}
/* Function vect_create_addr_base_for_vector_ref.
if (DR_PTR_INFO (dr)
&& TREE_CODE (addr_base) == SSA_NAME)
{
- duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr));
- unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
- int misalign = DR_MISALIGNMENT (dr);
- if (offset || byte_offset || (misalign == -1))
+ vect_duplicate_ssa_name_ptr_info (addr_base, dr, stmt_info);
+ if (offset || byte_offset)
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
- else
- set_ptr_info_alignment (SSA_NAME_PTR_INFO (addr_base), align, misalign);
}
if (dump_enabled_p ())
aggr_ptr_init = make_ssa_name (aggr_ptr, vec_stmt);
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
- duplicate_ssa_name_ptr_info (aggr_ptr_init, DR_PTR_INFO (dr));
+ vect_duplicate_ssa_name_ptr_info (aggr_ptr_init, dr, stmt_info);
gimple_assign_set_lhs (vec_stmt, aggr_ptr_init);
if (pe)
{
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
{
- duplicate_ssa_name_ptr_info (indx_before_incr, DR_PTR_INFO (dr));
- duplicate_ssa_name_ptr_info (indx_after_incr, DR_PTR_INFO (dr));
+ vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
+ vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
}
if (ptr_incr)
*ptr_incr = incr;
/* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr))
{
- duplicate_ssa_name_ptr_info (indx_before_incr, DR_PTR_INFO (dr));
- duplicate_ssa_name_ptr_info (indx_after_incr, DR_PTR_INFO (dr));
+ vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
+ vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
}
if (ptr_incr)
*ptr_incr = incr;