Hi! As mentioned in the PR, we ICE on the following testcase, because there are DRs in a GIMPLE_CALL stmt and when there is just one, we compute vectype for the call as if it were a load or store, but during computation of vectorization factor we only consider the return value of the call. As such calls are not vectorizable anyway, the following patch just gives up on them.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk (and with the if (bb_vinfo)/if (gather) parts removed for 4.6 too)? 2011-12-09 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/51485 * tree-vect-data-refs.c (vect_analyze_data_refs): Give up on DRs in call stmts. * g++.dg/vect/pr51485.cc: New test. --- gcc/tree-vect-data-refs.c.jj 2011-12-02 01:52:26.325893329 +0100 +++ gcc/tree-vect-data-refs.c 2011-12-09 13:27:29.726668859 +0100 @@ -2896,6 +2896,26 @@ vect_analyze_data_refs (loop_vec_info lo return false; } + if (is_gimple_call (stmt)) + { + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + { + fprintf (vect_dump, "not vectorized: dr in a call "); + print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + } + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + + if (gather) + free_data_ref (dr); + return false; + } + /* Update DR field in stmt_vec_info struct. */ /* If the dataref is in an inner-loop of the loop that is considered for --- gcc/testsuite/g++.dg/vect/pr51485.cc.jj 2011-12-09 13:28:45.155281405 +0100 +++ gcc/testsuite/g++.dg/vect/pr51485.cc 2011-12-09 13:28:57.692205773 +0100 @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +struct A { A (); unsigned int a; }; +double bar (A a) throw () __attribute__((pure)); + +void +foo (unsigned int x, double *y, A *z) +{ + unsigned int i; + for (i = 0; i < x; i++) + y[i] = bar (z[i]); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ Jakub