------- Comment #17 from rguenther at suse dot de 2008-09-22 11:14 ------- Subject: Re: [4.4 Regression] Revision 140257 causes vectorizer tests failures
On Mon, 22 Sep 2008, irar at il dot ibm dot com wrote: > ------- Comment #16 from irar at il dot ibm dot com 2008-09-22 10:33 ------- > (In reply to comment #15) > > This is because the original access is through a restricted pointer, so the > > check is conservatively correct at this point. We can move it to the > > point where the vector pointer is created > > But this way we move the check to the transformation and we don't have a > mechanism to stop in the middle of transformation. Right, but if we correctly base the vectorized access on the scalar one we never should fail this test (so I made it an assert - though logically inverted :(). WRT vect_create_data_ref_ptr not only we have to build a correctly restrict qualified type but also the decl (vect_get_new_vect_var) needs to have its DECL_POINTER_ALIAS_SET set correctly. So, like the following (which seems to work on x86_64, but it looks like all the testcases with restricted pointers are not supported on x86_64). Index: gcc/tree-vect-transform.c =================================================================== *** gcc/tree-vect-transform.c (revision 140544) --- gcc/tree-vect-transform.c (working copy) *************** vect_create_data_ref_ptr (gimple stmt, s *** 1077,1084 **** --- 1077,1095 ---- else vect_ptr_type = build_pointer_type (vectype); + if (TREE_CODE (DR_BASE_ADDRESS (dr)) == SSA_NAME + && TYPE_RESTRICT (TREE_TYPE (DR_BASE_ADDRESS (dr)))) + vect_ptr_type = build_qualified_type (vect_ptr_type, TYPE_QUAL_RESTRICT); vect_ptr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var, get_name (base_name)); + if (TREE_CODE (DR_BASE_ADDRESS (dr)) == SSA_NAME + && TYPE_RESTRICT (TREE_TYPE (DR_BASE_ADDRESS (dr)))) + { + get_alias_set (base_name); + DECL_POINTER_ALIAS_SET (vect_ptr) + = DECL_POINTER_ALIAS_SET (SSA_NAME_VAR (DR_BASE_ADDRESS (dr))); + } + add_referenced_var (vect_ptr); /** (2) Add aliasing information to the new vector-pointer: *************** vectorizable_load (gimple stmt, gimple_s *** 6388,6404 **** return false; } - /* If accesses through a pointer to vectype do not alias the original - memory reference we have a problem. This should never happen. */ - if (get_alias_set (vectype) != get_alias_set (gimple_assign_rhs1 (stmt)) - && !alias_set_subset_of (get_alias_set (vectype), - get_alias_set (gimple_assign_rhs1 (stmt)))) - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "??? vector type does not alias scalar type"); - return false; - } - /* The vector component type needs to be trivially convertible to the scalar lhs. This should always be the case. */ if (!useless_type_conversion_p (TREE_TYPE (scalar_dest), TREE_TYPE (vectype))) --- 6399,6404 ---- *************** vectorizable_load (gimple stmt, gimple_s *** 6662,6667 **** --- 6662,6672 ---- default: gcc_unreachable (); } + /* If accesses through a pointer to vectype do not alias the original + memory reference we have a problem. This should never happen. */ + gcc_assert (get_alias_set (data_ref) == get_alias_set (gimple_assign_rhs1 (stmt)) + || alias_set_subset_of (get_alias_set (data_ref), + get_alias_set (gimple_assign_rhs1 (stmt)))); vec_dest = vect_create_destination_var (scalar_dest, vectype); new_stmt = gimple_build_assign (vec_dest, data_ref); new_temp = make_ssa_name (vec_dest, new_stmt); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37491