Commit faf4220c by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/65450 (Unaligned access with -O3 -mtune=k8)

	PR tree-optimization/65450
	* tree-vect-data-refs.c (vect_duplicate_ssa_name_ptr_info): New
	function.
	(vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr): Use
	it instead of duplicate_ssa_name_ptr_info.

	* gfortran.dg/pr65450.f90: New test.

From-SVN: r221490
parent 43939937
2015-03-18 Jakub Jelinek <jakub@redhat.com> 2015-03-18 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65450
* tree-vect-data-refs.c (vect_duplicate_ssa_name_ptr_info): New
function.
(vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr): Use
it instead of duplicate_ssa_name_ptr_info.
PR target/65222 PR target/65222
* doc/invoke.texi: Add knl as x86 -march=/-mtune= CPU type. * doc/invoke.texi: Add knl as x86 -march=/-mtune= CPU type.
......
2015-03-18 Jakub Jelinek <jakub@redhat.com> 2015-03-18 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65450
* gfortran.dg/pr65450.f90: New test.
PR target/65078 PR target/65078
* gcc.target/i386/pr65078-1.c: New test. * gcc.target/i386/pr65078-1.c: New test.
* gcc.target/i386/pr65078-2.c: New test. * gcc.target/i386/pr65078-2.c: New test.
......
! 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
...@@ -3845,6 +3845,20 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name) ...@@ -3845,6 +3845,20 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
return new_vect_var; 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. /* Function vect_create_addr_base_for_vector_ref.
...@@ -3964,13 +3978,9 @@ vect_create_addr_base_for_vector_ref (gimple stmt, ...@@ -3964,13 +3978,9 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
if (DR_PTR_INFO (dr) if (DR_PTR_INFO (dr)
&& TREE_CODE (addr_base) == SSA_NAME) && TREE_CODE (addr_base) == SSA_NAME)
{ {
duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr)); vect_duplicate_ssa_name_ptr_info (addr_base, dr, stmt_info);
unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info)); if (offset || byte_offset)
int misalign = DR_MISALIGNMENT (dr);
if (offset || byte_offset || (misalign == -1))
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base)); 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 ()) if (dump_enabled_p ())
...@@ -4210,7 +4220,7 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, ...@@ -4210,7 +4220,7 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop,
aggr_ptr_init = make_ssa_name (aggr_ptr, vec_stmt); aggr_ptr_init = make_ssa_name (aggr_ptr, vec_stmt);
/* Copy the points-to information if it exists. */ /* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr)) 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); gimple_assign_set_lhs (vec_stmt, aggr_ptr_init);
if (pe) if (pe)
{ {
...@@ -4253,8 +4263,8 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, ...@@ -4253,8 +4263,8 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop,
/* Copy the points-to information if it exists. */ /* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr)) if (DR_PTR_INFO (dr))
{ {
duplicate_ssa_name_ptr_info (indx_before_incr, DR_PTR_INFO (dr)); vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
duplicate_ssa_name_ptr_info (indx_after_incr, DR_PTR_INFO (dr)); vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
} }
if (ptr_incr) if (ptr_incr)
*ptr_incr = incr; *ptr_incr = incr;
...@@ -4283,8 +4293,8 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, ...@@ -4283,8 +4293,8 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop,
/* Copy the points-to information if it exists. */ /* Copy the points-to information if it exists. */
if (DR_PTR_INFO (dr)) if (DR_PTR_INFO (dr))
{ {
duplicate_ssa_name_ptr_info (indx_before_incr, DR_PTR_INFO (dr)); vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
duplicate_ssa_name_ptr_info (indx_after_incr, DR_PTR_INFO (dr)); vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
} }
if (ptr_incr) if (ptr_incr)
*ptr_incr = incr; *ptr_incr = incr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment