http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40979
--- Comment #11 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-31 18:12:38 UTC --- Here is a reduced testcase from induct.f90 for the first loop not vectorized with -fgraphite-identity: module mqc_m integer, parameter, private :: longreal = selected_real_kind(15,90) contains subroutine mutual_ind_quad_cir_coil (m, l12) real (kind = longreal), dimension(9), save :: w2gauss, w1gauss real (kind = longreal) :: l12_lower, numerator real (kind = longreal), dimension(3) :: current_vector, coil_current_vec w2gauss(1) = 16.0_longreal/81.0_longreal w1gauss(5) = 0.3302393550_longreal do i = 1, 2*m do j = 1, 9 do k = 1, 9 numerator = w1gauss(j) * w2gauss(k) * & dot_product(coil_current_vec,current_vector) l12_lower = l12_lower + numerator end do end do end do l12 = l12_lower end subroutine mutual_ind_quad_cir_coil end module mqc_m The problem seems to be that graphite introduces a Commutative_Associative_Reduction array that confuses the vectorizer. I looked at how to improve translate_scalar_reduction_to_array in order to avoid the creation of the temporary array, but it seems to be difficult as the result is written to memory under a different type than the reduction itself: l12_lower is a real whereas l12 is an integer: l12_lower_200 = some_computation; # l12_lower_9 = PHI <l12_lower_16(D)(2), l12_lower_200(9)> D.1585_43 = (integer(kind=4)) l12_lower_9; # .MEM_48 = VDEF <.MEM_47> *l12_44(D) = D.1585_43; so we cannot use *l12_44(D) as a data reference in the loop to perform the reduction as it does not have the same precision as l12_lower: it seems to me that we cannot avoid creating the temporary array. The solution could be to clean up the temporary arrays after graphite.