[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #1 from irar at il dot ibm dot com 2009-01-05 13:19 --- Here is a reduced testcase: program test_elemental implicit none integer, dimension (2, 4) :: a integer, dimension (2, 4) :: b integer(kind = 8), dimension(2) :: c a = reshape ((/2, 3, 4, 5, 6, 7, 8, 9/), (/2, 4/)) b = 0 a = e_fn (a(:, 4:1:-1), 1 + b) ! This tests intrinsic elemental conversion functions. c = 2 * a(1, 1) if (any (c .ne. 14)) call abort ! This triggered bug due to building ss chains in the wrong order. b = 0; a = a - e_fn (a, b) if (any (a .ne. 0)) call abort contains elemental integer(kind=4) function e_fn (p, q) integer, intent(in) :: p, q e_fn = p - q end function end program The problem is that dse2 removes the stores to array A.4 which is used by the vectorized code: A.4[0] = D.1635_155; ... A.4[7] = D.1635_165; vect_pA.67_156 = (vector integer(kind=4) *) &A.4; vect_pa.73_197 = (vector integer(kind=4) *) &a; vect_var_.68_254 = *vect_pA.67_156; *vect_pa.73_197 = vect_var_.68_254; vect_pA.63_256 = vect_pA.67_156 + 16; vect_pa.69_257 = vect_pa.73_197 + 16; vect_var_.68_170 = *vect_pA.63_256; *vect_pa.69_257 = vect_var_.68_170; We propagate alias info from the scalar to vector ref in vect_create_data_ref_ptr() (in tree-vect-transform.c): /** (2) Add aliasing information to the new vector-pointer: (The points-to info (DR_PTR_INFO) may be defined later.) **/ tag = DR_SYMBOL_TAG (dr); gcc_assert (tag); /* If tag is a variable (and NOT_A_TAG) than a new symbol memory tag must be created with tag added to its may alias list. */ if (!MTAG_P (tag)) new_type_alias (vect_ptr, tag, DR_REF (dr)); else set_symbol_mem_tag (vect_ptr, tag); Those lines do not exist on the branch. Do you take care of this somewhere else? Ira -- irar at il dot ibm dot com changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2009-01-05 13:19:53 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #2 from rguenth at gcc dot gnu dot org 2009-01-06 19:42 --- This information does no longer exist on the branch (and thus it's not necessary to update it). But we are probably hitting PR38301 here, so I'll just test fixing that bug on the branch. Thanks for analyzing the failure! -- rguenth at gcc dot gnu dot org changed: What|Removed |Added BugsThisDependsOn||38301 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #3 from rguenth at gcc dot gnu dot org 2009-01-06 23:29 --- No, the issue is that A.3 is not in gimple_addressable_vars () and thus is considered non-aliased. The easiest thing to do is to re-compute addressable vars after the vectorizer. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #4 from rguenth at gcc dot gnu dot org 2009-01-07 11:09 --- Mine anyway. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2009-01-05 13:19:53 |2009-01-07 11:09:14 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #5 from rguenth at gcc dot gnu dot org 2009-01-08 12:29 --- Subject: Bug 38721 Author: rguenth Date: Thu Jan 8 12:29:46 2009 New Revision: 143185 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143185 Log: 2009-01-07 Richard Guenther PR tree-optimization/38721 * tree-into-ssa.c (pass_build_ssa): Add TODO_update_address_taken. * tree-pass.h (TODO_update_address_taken): New flag. * tree-ssa-loop.c (tree_ssa_loop_ivopts): Update address-taken. * tree-ssa.c (execute_update_addresses_taken): Optimize only when optimizing. (pass_update_address_taken): Just use TODO_update_address_taken. * tree-flow.h (execute_update_addresses_taken): Update prototype. * tree-cfg.c (verify_expr): Verify that stmt addresses-taken and function addressable-vars are conservatively correct. (verify_stmt): Initialize gsi of walk data. * tree-inline.c (optimize_inline_calls): Execute TODO_update_address_taken. (tree_function_versioning): Call execute_update_addresses_taken. * passes.c (execute_function_todo): Handle TODO_update_address_taken. (init_optimization_passes): Remove redundant update-address-taken pass after final inlining. * tree-parloops.c (parallelize_loops): Call execute_update_addresses_taken. * tree-vectorizer.c (vectorize_loops): Likewise. Modified: branches/alias-improvements/gcc/ChangeLog.alias branches/alias-improvements/gcc/passes.c branches/alias-improvements/gcc/tree-cfg.c branches/alias-improvements/gcc/tree-flow.h branches/alias-improvements/gcc/tree-inline.c branches/alias-improvements/gcc/tree-into-ssa.c branches/alias-improvements/gcc/tree-parloops.c branches/alias-improvements/gcc/tree-pass.h branches/alias-improvements/gcc/tree-ssa-loop.c branches/alias-improvements/gcc/tree-ssa.c branches/alias-improvements/gcc/tree-vectorizer.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #6 from rguenth at gcc dot gnu dot org 2009-01-08 14:59 --- Fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721
[Bug tree-optimization/38721] [alias-improvements] vectorizer miscompiles gfortran.fortran-torture/execute/elemental.f90 at -O3
--- Comment #7 from rguenth at gcc dot gnu dot org 2009-01-09 12:25 --- Subject: Bug 38721 Author: rguenth Date: Fri Jan 9 12:25:00 2009 New Revision: 143200 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143200 Log: 2009-01-09 Richard Guenther Revert 2009-01-07 Richard Guenther PR tree-optimization/38721 * tree-into-ssa.c (pass_build_ssa): Add TODO_update_address_taken. * tree-ssa-loop.c (tree_ssa_loop_ivopts): Update address-taken. * tree-cfg.c (verify_expr): Verify that stmt addresses-taken and function addressable-vars are conservatively correct. (verify_stmt): Initialize gsi of walk data. * tree-inline.c (optimize_inline_calls): Execute TODO_update_address_taken. (tree_function_versioning): Call execute_update_addresses_taken. * passes.c (init_optimization_passes): Remove redundant update-address-taken pass after final inlining. * tree-parloops.c (parallelize_loops): Call execute_update_addresses_taken. * tree-vectorizer.c (vectorize_loops): Likewise. Modified: branches/alias-improvements/gcc/ChangeLog.alias branches/alias-improvements/gcc/passes.c branches/alias-improvements/gcc/tree-cfg.c branches/alias-improvements/gcc/tree-inline.c branches/alias-improvements/gcc/tree-into-ssa.c branches/alias-improvements/gcc/tree-parloops.c branches/alias-improvements/gcc/tree-ssa-loop.c branches/alias-improvements/gcc/tree-vectorizer.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38721