From 96e2d1d1ae69d409e3052d45f79f471c2caf6c9a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 2 Oct 2017 10:04:00 +0000 Subject: [PATCH] graphite-isl-ast-to-gimple.c (set_codegen_error): With -fchecking and --param graphite-allow-codegen-errors=0 ICE. 2017-10-02 Richard Biener * graphite-isl-ast-to-gimple.c (set_codegen_error): With -fchecking and --param graphite-allow-codegen-errors=0 ICE. * params.def (PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS): New param. * gcc.dg/graphite/graphite.exp: Add -fdump-tree-graphite-details. * gcc.dg/graphite/id-15.c: Adjust for existing codegen errors. * gcc.dg/graphite/id-16.c: Likewise. * gcc.dg/graphite/pr46168.c: Likewise. * gcc.dg/graphite/pr68756.c: Likewise. * gcc.dg/graphite/pr69728.c: Likewise. * gcc.dg/graphite/pr71575-2.c: Likewise. * gcc.dg/graphite/pr77362.c: Likewise. * gcc.dg/graphite/pr81373.c: Likewise. * gcc.dg/graphite/run-id-pr67700-1.c: Likewise. * gfortran.dg/graphite/interchange-1.f: Likewise. * gfortran.dg/graphite/pr29581.f90: Likewise. * gfortran.dg/graphite/pr42334-1.f: Likewise. * gfortran.dg/graphite/pr42393-1.f90: Likewise. * gfortran.dg/graphite/pr42393.f90: Likewise. * gfortran.dg/graphite/pr47019.f: Likewise. From-SVN: r253342 --- gcc/ChangeLog | 6 ++++++ gcc/graphite-isl-ast-to-gimple.c | 9 ++++++++- gcc/params.def | 6 ++++++ gcc/testsuite/ChangeLog | 19 +++++++++++++++++++ gcc/testsuite/gcc.dg/graphite/graphite.exp | 4 ++-- gcc/testsuite/gcc.dg/graphite/id-15.c | 2 ++ gcc/testsuite/gcc.dg/graphite/id-16.c | 4 ++++ gcc/testsuite/gcc.dg/graphite/pr46168.c | 4 +++- gcc/testsuite/gcc.dg/graphite/pr68756.c | 4 +++- gcc/testsuite/gcc.dg/graphite/pr69728.c | 4 +++- gcc/testsuite/gcc.dg/graphite/pr71575-2.c | 4 +++- gcc/testsuite/gcc.dg/graphite/pr77362.c | 3 ++- gcc/testsuite/gcc.dg/graphite/pr81373.c | 3 ++- .../gcc.dg/graphite/run-id-pr67700-1.c | 3 +++ .../gfortran.dg/graphite/interchange-1.f | 2 ++ .../gfortran.dg/graphite/pr29581.f90 | 4 +++- .../gfortran.dg/graphite/pr42334-1.f | 4 +++- .../gfortran.dg/graphite/pr42393-1.f90 | 4 +++- .../gfortran.dg/graphite/pr42393.f90 | 4 +++- gcc/testsuite/gfortran.dg/graphite/pr47019.f | 4 +++- 20 files changed, 83 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 822afa0c88d..a2e33e4b910 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-02 Richard Biener + + * graphite-isl-ast-to-gimple.c (set_codegen_error): With + -fchecking and --param graphite-allow-codegen-errors=0 ICE. + * params.def (PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS): New param. + 2017-10-02 Richard Sandiford * tree.h (wi::int_traits ::decompose): Assert that the diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index fb91ba15eac..3022f0005dc 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -240,7 +240,14 @@ class translate_isl_ast_to_gimple void gsi_insert_earliest (gimple_seq seq); tree rename_all_uses (tree new_expr, basic_block new_bb, basic_block old_bb); bool codegen_error_p () const { return codegen_error; } - void set_codegen_error () { codegen_error = true; } + + void set_codegen_error () + { + codegen_error = true; + gcc_assert (! flag_checking + || PARAM_VALUE (PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS)); + } + bool is_constant (tree op) const { return TREE_CODE (op) == INTEGER_CST diff --git a/gcc/params.def b/gcc/params.def index 136f9270366..e55afc28053 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -894,6 +894,12 @@ DEFPARAM (PARAM_MAX_ISL_OPERATIONS, "maximum number of isl operations, 0 means unlimited", 350000, 0, 0) +/* For testsuite purposes allow to check for codegen error handling. */ +DEFPARAM (PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS, + "graphite-allow-codegen-errors", + "whether codegen errors should be ICEs when -fchecking.", + 0, 0, 1) + /* Avoid data dependence analysis on very large loops. */ DEFPARAM (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS, "loop-max-datarefs-for-datadeps", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1edc61ee2f4..0214693486f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2017-10-02 Richard Biener + + * gcc.dg/graphite/graphite.exp: Add -fdump-tree-graphite-details. + * gcc.dg/graphite/id-15.c: Adjust for existing codegen errors. + * gcc.dg/graphite/id-16.c: Likewise. + * gcc.dg/graphite/pr46168.c: Likewise. + * gcc.dg/graphite/pr68756.c: Likewise. + * gcc.dg/graphite/pr69728.c: Likewise. + * gcc.dg/graphite/pr71575-2.c: Likewise. + * gcc.dg/graphite/pr77362.c: Likewise. + * gcc.dg/graphite/pr81373.c: Likewise. + * gcc.dg/graphite/run-id-pr67700-1.c: Likewise. + * gfortran.dg/graphite/interchange-1.f: Likewise. + * gfortran.dg/graphite/pr29581.f90: Likewise. + * gfortran.dg/graphite/pr42334-1.f: Likewise. + * gfortran.dg/graphite/pr42393-1.f90: Likewise. + * gfortran.dg/graphite/pr42393.f90: Likewise. + * gfortran.dg/graphite/pr47019.f: Likewise. + 2017-10-02 Paolo Carlini PR c++/69977 diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index 50aae309ffd..646d192ee7f 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -57,11 +57,11 @@ set vect_files [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ] # Tests to be compiled. set dg-do-what-default compile dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" -dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" +dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math -fdump-tree-graphite-details" # Tests to be run. set dg-do-what-default run -dg-runtest $run_id_files "" "-O2 -fgraphite-identity" +dg-runtest $run_id_files "" "-O2 -fgraphite-identity -fdump-tree-graphite-details" dg-runtest $opt_files "" "-O2 -ffast-math -floop-nest-optimize -fdump-tree-graphite-all" # Vectorizer tests, to be run or compiled, depending on target capabilities. diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c b/gcc/testsuite/gcc.dg/graphite/id-15.c index b57c209698e..ac5c6495dc7 100644 --- a/gcc/testsuite/gcc.dg/graphite/id-15.c +++ b/gcc/testsuite/gcc.dg/graphite/id-15.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target int32plus } */ +/* { dg-additional-options "--param graphite-allow-codegen-errors=1" { target ilp32 } } */ typedef long unsigned int size_t; extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))); @@ -118,3 +119,4 @@ mul_double (l1, h1, l2, h2, lv, hv) return (*hv < 0 ? ~(toplow & tophigh) : toplow | tophigh) != 0; } +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" { target ilp32 } } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/id-16.c b/gcc/testsuite/gcc.dg/graphite/id-16.c index faa685f8014..bc1c29fd1e4 100644 --- a/gcc/testsuite/gcc.dg/graphite/id-16.c +++ b/gcc/testsuite/gcc.dg/graphite/id-16.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "--param graphite-allow-codegen-errors=1" } */ + int transformation[(2*19 - 1) * (2*19 - 1)][8]; const int transformation2[8][2][2] = { @@ -42,3 +44,5 @@ transformation_init (void) } } } + +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr46168.c b/gcc/testsuite/gcc.dg/graphite/pr46168.c index 28b48415d97..97a8adf6ece 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr46168.c +++ b/gcc/testsuite/gcc.dg/graphite/pr46168.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O -ftree-loop-linear" } */ +/* { dg-options "-O -ftree-loop-linear -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } */ int foo (int a[4096], int mi, int mj) @@ -13,3 +13,5 @@ foo (int a[4096], int mi, int mj) } return i16; } + +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr68756.c b/gcc/testsuite/gcc.dg/graphite/pr68756.c index ddb9789f133..3307d747f9f 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr68756.c +++ b/gcc/testsuite/gcc.dg/graphite/pr68756.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -floop-nest-optimize" } */ +/* { dg-options "-O1 -floop-nest-optimize -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } */ unsigned int z4, pz; int nn[2]; @@ -24,3 +24,5 @@ la (void) pz = xq (hn); } } + +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr69728.c b/gcc/testsuite/gcc.dg/graphite/pr69728.c index 35ea5bd15bb..771d19d98be 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr69728.c +++ b/gcc/testsuite/gcc.dg/graphite/pr69728.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -floop-nest-optimize" } */ +/* { dg-options "-O3 -floop-nest-optimize -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } */ int a[1]; int b, c, d, e; @@ -19,3 +19,5 @@ fn1 () } } } + +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr71575-2.c b/gcc/testsuite/gcc.dg/graphite/pr71575-2.c index 24bc957b2d6..59c78c2c5fc 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr71575-2.c +++ b/gcc/testsuite/gcc.dg/graphite/pr71575-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Ofast -floop-nest-optimize" } */ +/* { dg-options "-Ofast -floop-nest-optimize -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } */ int *a; int b, c, d, e, g; @@ -14,3 +14,5 @@ void fn1() { } } } + +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr77362.c b/gcc/testsuite/gcc.dg/graphite/pr77362.c index 61b7a7dea41..06681fd3a37 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr77362.c +++ b/gcc/testsuite/gcc.dg/graphite/pr77362.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -floop-nest-optimize" } */ +/* { dg-options "-O2 -floop-nest-optimize -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } */ int mc[2]; int f2, sk; @@ -19,3 +19,4 @@ zm (void) } } +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr81373.c b/gcc/testsuite/gcc.dg/graphite/pr81373.c index 588b9d00732..4427c472d56 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr81373.c +++ b/gcc/testsuite/gcc.dg/graphite/pr81373.c @@ -1,4 +1,4 @@ -/* { dg-options "-fno-tree-scev-cprop -fgraphite-identity -O -fdump-tree-graphite-all" } */ +/* { dg-options "-fno-tree-scev-cprop -fgraphite-identity -O -fdump-tree-graphite-all --param graphite-allow-codegen-errors=1" } */ void bar (void); @@ -38,3 +38,4 @@ int toto() } /* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-pr67700-1.c b/gcc/testsuite/gcc.dg/graphite/run-id-pr67700-1.c index e0db2561e7d..da54cf964ae 100644 --- a/gcc/testsuite/gcc.dg/graphite/run-id-pr67700-1.c +++ b/gcc/testsuite/gcc.dg/graphite/run-id-pr67700-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "--param graphite-allow-codegen-errors=1" } */ + #include #include @@ -46,3 +48,4 @@ int main() return 0; } +/* { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } */ diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f index d19cf70c166..466284e1fbd 100644 --- a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f +++ b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f @@ -1,3 +1,4 @@ +! { dg-additional-options "--param graphite-allow-codegen-errors=1" } subroutine foo(f1,f2,f3,f4,f5,f6,f7,f8,f9,f0,g1,g2,g3) implicit none integer f4,f3,f2,f1 @@ -42,3 +43,4 @@ ! kernel from bwaves. ! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr29581.f90 b/gcc/testsuite/gfortran.dg/graphite/pr29581.f90 index 3e4a39efb63..223baf8da6f 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr29581.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/pr29581.f90 @@ -1,6 +1,6 @@ ! PR tree-optimization/29581 ! { dg-do run } -! { dg-options "-O2 -ftree-loop-linear" } +! { dg-options "-O2 -ftree-loop-linear -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } SUBROUTINE FOO (K) INTEGER I, J, K, A(5,5), B @@ -25,3 +25,5 @@ A(1,1) = 0 IF (ANY(A.NE.0)) CALL ABORT END + +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr42334-1.f b/gcc/testsuite/gfortran.dg/graphite/pr42334-1.f index 2503dc3e8f2..fd6f71d5066 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr42334-1.f +++ b/gcc/testsuite/gfortran.dg/graphite/pr42334-1.f @@ -1,4 +1,4 @@ -! { dg-options "-O2 -floop-interchange" } +! { dg-options "-O2 -floop-interchange -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } subroutine linel(icmdl,stre,anisox) real*8 stre(6),tkl(3,3),ekl(3,3),anisox(3,3,3,3) @@ -14,3 +14,5 @@ enddo stre(1)=tkl(1,1) end + +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90 b/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90 index fb62e20f45c..84c9c57b24e 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/pr42393-1.f90 @@ -1,4 +1,4 @@ -! { dg-options "-O2 -fgraphite-identity -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine" } +! { dg-options "-O2 -fgraphite-identity -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine --param graphite-allow-codegen-errors=1" } MODULE beta_gamma_psi INTEGER, PARAMETER :: dp=KIND(0.0D0) @@ -22,3 +22,5 @@ CONTAINS fn_val = sum END FUNCTION basym END MODULE beta_gamma_psi + +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr42393.f90 b/gcc/testsuite/gfortran.dg/graphite/pr42393.f90 index 1fc708ef967..f0255ca0ed2 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr42393.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/pr42393.f90 @@ -1,4 +1,4 @@ -! { dg-options "-O2 -fgraphite-identity -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine" } +! { dg-options "-O2 -fgraphite-identity -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } MODULE beta_gamma_psi INTEGER, PARAMETER :: dp=KIND(0.0D0) @@ -28,3 +28,5 @@ CONTAINS fn_val = e0*t*u*sum END FUNCTION basym END MODULE beta_gamma_psi + +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/graphite/pr47019.f b/gcc/testsuite/gfortran.dg/graphite/pr47019.f index 69067e9c500..8f0c80ceb19 100644 --- a/gcc/testsuite/gfortran.dg/graphite/pr47019.f +++ b/gcc/testsuite/gfortran.dg/graphite/pr47019.f @@ -1,4 +1,4 @@ -! { dg-options "-O -ftree-pre -fgraphite-identity -fno-tree-copy-prop" } +! { dg-options "-O -ftree-pre -fgraphite-identity -fno-tree-copy-prop -fdump-tree-graphite-details --param graphite-allow-codegen-errors=1" } subroutine foo (ldmx,ldmy,v) integer :: ldmx, ldmy, v, l, m @@ -10,3 +10,5 @@ v(m,3,2) = m end do end + +! { dg-final { scan-tree-dump-times "code generation error" 1 "graphite" } } -- 2.30.2