[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #24 from rguenth at gcc dot gnu dot org 2008-11-28 11:30 --- Fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #25 from rguenth at gcc dot gnu dot org 2008-11-28 11:32 --- Subject: Bug 37742 Author: rguenth Date: Fri Nov 28 11:30:45 2008 New Revision: 142257 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142257 Log: 2008-11-28 Richard Guenther [EMAIL PROTECTED] PR tree-optimization/37955 PR tree-optimization/37742 * tree-vect-transform.c (vectorizable_store): Remove assert for compatible aliases. (vectorizable_load): Likewise. * gcc.c-torture/compile/pr37955.c: New testcase. * gcc.c-torture/compile/pr37742-3.c: Likewise. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr37742-3.c trunk/gcc/testsuite/gcc.c-torture/compile/pr37955.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-transform.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #23 from rguenth at gcc dot gnu dot org 2008-11-21 11:09 --- We actually usually never ask for the alias set of an indirect reference, but instead we seem to use the pointed-to type instead which doesn't inherit the restrict handling. Otherwise we would miscompile even the trivial int foo (int *__restrict p) { int *__restrict q; int v; q = p + 1; q = q - 1; v = *q; *p = 1; return v + *q; } extern void abort (void); int main() { int i = 0; if (foo (i) != 1) abort (); return 0; } because q is not based on the restrict p and both pointers would get distinct alias-sets which you can verify by calling get_alias_set on the indirect-refs. So one way to fix the issue in the vectorizer is to avoid calling get_alias_set on the indirect-refs as well. Or to rip out all the broken restrict handling from the compiler. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #20 from rguenth at gcc dot gnu dot org 2008-11-20 16:25 --- Reduced testcase for the libgfortran failure (-O2 -ftree-vectorize): void matmul_i4 (int * __restrict dest_y, const int * __restrict abase, const int * __restrict bbase_y, int count, int xcount, int ycount, int aystride) { int x, y, n; const int * __restrict abase_n; int bbase_yn; for (y = 0; y ycount; y++) for (n = 0; n count; n++) { abase_n = abase + n*aystride; bbase_yn = bbase_y[n]; for (x = 0; x xcount; x++) dest_y[x] += abase_n[x] * bbase_yn; } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #21 from rguenth at gcc dot gnu dot org 2008-11-20 17:15 --- The problem with our restrict handling seems to be deeper. We fail to set the based-on-restrict property properly. abase_n{4}_13 = abase{-2}_12(D) + D.1614_11; so here abase_n and abase are not properly connected... unfortunately that seems to be a very deep rooted problem (and obviously our restrict handling is broken anyway ...) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #22 from rguenth at gcc dot gnu dot org 2008-11-20 17:22 --- For 4.4 I will collect the fixes and just disable the assertion... we cannot fix this properly without switching to a completely points-to based restrict implementation (lumping restrict together with TBAA info is fundamentally broken anyway). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #19 from rguenther at suse dot de 2008-11-19 17:43 --- Subject: Re: [4.4 Regression] ICE in vectorizer with restrict pointer On Tue, 18 Nov 2008, jakub at gcc dot gnu dot org wrote: --- Comment #18 from jakub at gcc dot gnu dot org 2008-11-18 20:13 --- Created an attachment (id=16719) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16719action=view) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16719action=view) incremental patch This fixed matmul_i2.c, DR_BASE_ADDRESS wasn't in this case TYPE_RESTRICT, nor SSA_NAME, but POINTER_PLUS_EXPR, yet in the end was based on a restrict pointer. Unfortunately other matmul*.c stuff in libgfortran is still broken. I'm wondering if the strict alias checking introduced in r140781 isn't too eager when restricted pointers are used... It can/should be relaxed to do an alias_sets_conflict_p check instead of the subset check. No idea if that helps - but also the patch at http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00286.html should fix all of the current issues (maybe not optimally though). Note that I added the alias checks to catch wrong-code issues. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #17 from jakub at gcc dot gnu dot org 2008-11-18 18:26 --- Created an attachment (id=16718) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16718action=view) gcc44-pr37742.patch Testcase #c7 can be fixed by this patch. Without it, alias sets in presence of restricted pointers act weirdly - if it is called on an INDIRECT_REF with a SSA_NAME, it will return one alias set, but if a new INDIRECT_REF is constructed from the SSA_NAME's var decl, then a different alias set is returned. Unfortunately this patch breaks bootstrap in matmul_i2.c, ICE in vectorizable_store. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #18 from jakub at gcc dot gnu dot org 2008-11-18 20:13 --- Created an attachment (id=16719) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16719action=view) incremental patch This fixed matmul_i2.c, DR_BASE_ADDRESS wasn't in this case TYPE_RESTRICT, nor SSA_NAME, but POINTER_PLUS_EXPR, yet in the end was based on a restrict pointer. Unfortunately other matmul*.c stuff in libgfortran is still broken. I'm wondering if the strict alias checking introduced in r140781 isn't too eager when restricted pointers are used... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #16 from reichelt at gcc dot gnu dot org 2008-11-11 08:12 --- The testcase in comment #7 (and the original code in comment #4) still crashes. -- reichelt at gcc dot gnu dot org changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #13 from rguenth at gcc dot gnu dot org 2008-11-05 12:17 --- 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=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #14 from rguenth at gcc dot gnu dot org 2008-11-05 12:18 --- Subject: Bug 37742 Author: rguenth Date: Wed Nov 5 12:17:10 2008 New Revision: 141606 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=141606 Log: 2008-11-05 Richard Guenther [EMAIL PROTECTED] PR middle-end/37742 * tree-ssa.c (useless_type_conversion_p_1): Check different restrict qualified pointer conversion before stripping qualifiers. * gimplify.c (create_tmp_from_val): Use correctly qualified type. * tree-flow.h (may_propagate_address_into_dereference): Declare. * tree-ssa-ccp.c (may_propagate_address_into_dereference): New function. (ccp_fold): Use it. * tree-ssa-forwprop.c (rhs_to_tree): Remove useless conversions, properly canonicalize binary ops. (forward_propagate_addr_expr_1): Use may_propagate_address_into_dereference. cp/ * decl.c (start_preparsed_function): Use the correct type for building the RESULT_DECL. * gcc.c-torture/compile/pr37742.c: New testcase. * g++.dg/pr37742.C: Likewise. * gcc.dg/tree-ssa/forwprop-7.c: Check for two volatile loads. Added: trunk/gcc/testsuite/g++.dg/pr37742.C trunk/gcc/testsuite/gcc.c-torture/compile/pr37742.c Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/gimplify.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-7.c trunk/gcc/tree-flow.h trunk/gcc/tree-ssa-ccp.c trunk/gcc/tree-ssa-forwprop.c trunk/gcc/tree-ssa.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #15 from linuxl4 at sohu dot com 2008-11-06 01:23 --- really ? my gcc is r141610 [~/tmp]$gcc -O2 -march=pentium4 -ftree-vectorize opsum.c ../../../../src/mpi/coll/opsum.c: In function 'MPIR_SUM': ../../../../src/mpi/coll/opsum.c:21: internal compiler error: in vectorizable_load, at tree-vect-transform.c:6675 Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions. -- linuxl4 at sohu dot com changed: What|Removed |Added CC||linuxl4 at sohu dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
-- mmitchel at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #12 from rguenth at gcc dot gnu dot org 2008-10-14 20:46 --- This is because data-ref uses p1 for DR_BASE_ADDRESS instead of p (which is restrict qualified), for the scalar load we do not do this propagation because we try to retain restrict qualifications. simple_iv () in dr_analyze_innermost computes for the iv base (int * restrict) p1_4(D) + 4 and canonicalize_base_object_address gets passed (int * restrict) p1_4(D) after splitting away the offset. This just strips NOPs, so the restrict qualification gets lost here. I have a patch. So the assert in this case hints at a missed-optimization. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #11 from pinskia at gcc dot gnu dot org 2008-10-13 21:37 --- *** Bug 37817 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||dcb314 at hotmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #10 from rguenth at gcc dot gnu dot org 2008-10-10 07:49 --- I will have a look. -- 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|2008-10-07 21:04:07 |2008-10-10 07:49:58 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer
--- Comment #9 from reichelt at gcc dot gnu dot org 2008-10-09 20:51 --- I just stumbled over the same bug and a similar ICE in vectorizable_store: The following valid code snippet triggers an ICE on mainline when compiled with -march=pentium4 -O2 -ftree-vectorize on i686-pc-linux-gnu: == void foo(int* __restrict__ p, int* q, int* p1, int *q1) { int i; p = p1; q = q1; for (i = 0; i 4; ++i) *++q = *++p + 1; } == bug.c: In function 'foo': bug.c:1: internal compiler error: in vectorizable_load, at tree-vect-transform.c:6675 Please submit a full bug report, [etc.] Moving the restrict keyword triggers a slightly different ICE: == void foo(int* p, int* __restrict__ q, int* p1, int *q1) { int i; p = p1; q = q1; for (i = 0; i 4; ++i) *++q = *++p + 1; } == bug.c: In function 'foo': bug.c:1: internal compiler error: in vectorizable_store, at tree-vect-transform.c:5447 Please submit a full bug report, [etc.] This is a recent regression, introduced between 2008-09-29 and 2008-10-08. -- reichelt at gcc dot gnu dot org changed: What|Removed |Added CC||reichelt at gcc dot gnu dot ||org Keywords||monitored Summary|[4.4 Regression] ICE in |[4.4 Regression] ICE in |vectorizer with restrict|vectorizer with restrict |pointer to struct |pointer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer to struct
--- Comment #7 from pinskia at gcc dot gnu dot org 2008-10-07 21:04 --- Reduced testcase: typedef struct { float re; float im; } d_complex; void MPIR_SUM ( d_complex * __restrict a, d_complex * __restrict b, int len) { int i; for ( i=0; ilen; i++ ) { a[i].re = ((a[i].re)+(b[i].re)); a[i].im = ((a[i].im)+(b[i].im)); } } -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|i686-pc-linux-gnu | GCC host triplet|i686-pc-linux-gnu | GCC target triplet|i686-pc-linux-gnu |i?86-*-* x86_64-*-* Keywords||ice-on-valid-code Last reconfirmed|-00-00 00:00:00 |2008-10-07 21:04:07 date|| Summary|ICE when compile mpich2-|[4.4 Regression] ICE in |1.1.0a1 |vectorizer with restrict ||pointer to struct Target Milestone|--- |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742
[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer to struct
--- Comment #8 from pinskia at gcc dot gnu dot org 2008-10-07 21:04 --- Also happens on powerpc64-linux-gnu with -maltivec. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added GCC target triplet|i?86-*-* x86_64-*-* | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742