From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id 85A66389683C; Tue, 15 Jun 2021 09:32:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85A66389683C Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] For 'OMP_CLAUSE' in 'dump_generic_node', dump the whole OMP clause chain X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/devel/omp/gcc-11 X-Git-Oldrev: fa0f91ce548ace32940ea4e0a1b6b36627144c94 X-Git-Newrev: 89f4f339130c39afab7c4a9aad5fec8a48f0c95d Message-Id: <20210615093220.85A66389683C@sourceware.org> Date: Tue, 15 Jun 2021 09:32:20 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2021 09:32:20 -0000 https://gcc.gnu.org/g:89f4f339130c39afab7c4a9aad5fec8a48f0c95d commit 89f4f339130c39afab7c4a9aad5fec8a48f0c95d Author: Thomas Schwinge Date: Tue Jun 15 10:43:21 2021 +0200 For 'OMP_CLAUSE' in 'dump_generic_node', dump the whole OMP clause chain ... instead of just the first clause. gcc/ * tree-pretty-print.h (dump_omp_clauses): Add 'bool = true' default argument. * tree-pretty-print.c (dump_omp_clauses): Update. (dump_generic_node) : Use it. gcc/testsuite/ * gcc.dg/gomp/simd-clones-2.c: Enhance. (cherry picked from commit 2973090c4c62105cbb61bfc6f83be903e3c46c71) Diff: --- gcc/ChangeLog.omp | 10 ++++++++++ gcc/testsuite/ChangeLog.omp | 7 +++++++ gcc/testsuite/gcc.dg/gomp/simd-clones-2.c | 2 ++ gcc/tree-pretty-print.c | 31 +++++++++++++++++-------------- gcc/tree-pretty-print.h | 3 ++- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 8bedf3033e9..28758c6fb49 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,13 @@ +2021-06-15 Tobias Burnus + + Backported from master: + 2021-06-11 Thomas Schwinge + + * tree-pretty-print.h (dump_omp_clauses): Add 'bool = true' + default argument. + * tree-pretty-print.c (dump_omp_clauses): Update. + (dump_generic_node) : Use it. + 2021-06-08 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 93b3a7ad766..cf4b5e5e155 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,10 @@ +2021-06-15 Tobias Burnus + + Backported from master: + 2021-06-11 Thomas Schwinge + + * gcc.dg/gomp/simd-clones-2.c: Enhance. + 2021-06-09 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c index 75554de9339..9f7c84dc70b 100644 --- a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c @@ -7,6 +7,7 @@ int addit(int a, int b, int *c) return a + b; } /* { dg-warning "GCC does not currently support mixed size types for 'simd' functions" "" { target aarch64*-*-* } .-4 } */ +/* { dg-final { scan-tree-dump {(?n)^__attribute__\(\(omp declare simd \(notinbranch aligned\(2:32\)\), omp declare simd \(inbranch uniform\(2\) linear\(1:66\)\)\)\)$} "optimized" } } */ #pragma omp declare simd uniform(a) aligned(a:32) linear(k:1) notinbranch float setArray(float *a, float x, int k) @@ -14,6 +15,7 @@ float setArray(float *a, float x, int k) a[k] = a[k] + x; return a[k]; } +/* { dg-final { scan-tree-dump {(?n)^__attribute__\(\(omp declare simd \(notinbranch uniform\(0\) aligned\(0:32\) linear\(2:1\)\)\)\)$} "optimized" } } */ /* { dg-final { scan-tree-dump "_ZGVbN4ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */ /* { dg-final { scan-tree-dump "_ZGVbN4vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 667bdc20e4b..c03ee3d1f1f 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -442,8 +442,9 @@ dump_omp_iterators (pretty_printer *pp, tree iter, int spc, dump_flags_t flags) } -/* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in - dump_generic_node. */ +/* Dump OMP clause CLAUSE, without following OMP_CLAUSE_CHAIN. + + PP, CLAUSE, SPC and FLAGS are as in dump_generic_node. */ static void dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) @@ -1369,23 +1370,22 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) } -/* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in - dump_generic_node. */ +/* Dump chain of OMP clauses. + + PP, SPC and FLAGS are as in dump_generic_node. */ void -dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags) +dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags, + bool leading_space) { - if (clause == NULL) - return; - - pp_space (pp); - while (1) + while (clause) { + if (leading_space) + pp_space (pp); dump_omp_clause (pp, clause, spc, flags); + leading_space = true; + clause = OMP_CLAUSE_CHAIN (clause); - if (clause == NULL) - return; - pp_space (pp); } } @@ -3695,7 +3695,10 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, goto dump_omp_body; case OMP_CLAUSE: - dump_omp_clause (pp, node, spc, flags); + /* If we come here, we're dumping something that's not an OMP construct, + for example, OMP clauses attached to a function's '__attribute__'. + Dump the whole OMP clause chain. */ + dump_omp_clauses (pp, node, spc, flags, false); is_expr = false; break; diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h index 92eb4123e79..cafe9aa9598 100644 --- a/gcc/tree-pretty-print.h +++ b/gcc/tree-pretty-print.h @@ -39,7 +39,8 @@ extern void print_generic_stmt (FILE *, tree, dump_flags_t = TDF_NONE); extern void print_generic_stmt_indented (FILE *, tree, dump_flags_t, int); extern void print_generic_expr (FILE *, tree, dump_flags_t = TDF_NONE); extern char *print_generic_expr_to_str (tree); -extern void dump_omp_clauses (pretty_printer *, tree, int, dump_flags_t); +extern void dump_omp_clauses (pretty_printer *, tree, int, dump_flags_t, + bool = true); extern void dump_omp_atomic_memory_order (pretty_printer *, enum omp_memory_order); extern void dump_omp_loop_non_rect_expr (pretty_printer *, tree, int,