public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Julian Brown <jules@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] [og11] OpenMP/OpenACC: Move array_ref/indirect_ref handling code out of extract_base_bit_offset Date: Mon, 7 Jun 2021 13:46:36 +0000 (GMT) [thread overview] Message-ID: <20210607134636.B4ED63833002@sourceware.org> (raw) https://gcc.gnu.org/g:90a3960d407d3a02ad7679d0bf58d8052e5d1feb commit 90a3960d407d3a02ad7679d0bf58d8052e5d1feb Author: Julian Brown <julian@codesourcery.com> Date: Thu Jun 3 06:47:00 2021 -0700 [og11] OpenMP/OpenACC: Move array_ref/indirect_ref handling code out of extract_base_bit_offset At Richard Biener's suggestion, this patch undoes the following patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571712.html and moves the stripping of ARRAY_REFS/INDIRECT_REFS out of extract_base_bit_offset and back into the (two) call sites of the function. The difference between the two ways of looking through these nodes comes down to (I think) what processing has been done on the clause in question already: in the case where BASE_REF is non-NULL, we are processing an OMP_CLAUSE_DECL for the first time. Conversely, when BASE_REF is NULL, we are processing a node from the sorted list that is being constructed after a GOMP_MAP_STRUCT node. 2021-06-07 Julian Brown <julian@codesourcery.com> gcc/ * gimplify.c (extract_base_bit_offset): Don't look through ARRAY_REFs or INDIRECT_REFs here. (build_struct_group): Reinstate previous behaviour for handling ARRAY_REFs/INDIRECT_REFs. Diff: --- gcc/gimplify.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c6ebef8e41c..1742a2cb564 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8526,20 +8526,6 @@ extract_base_bit_offset (tree base, tree *base_ind, tree *base_ref, if (base_ref) *base_ref = NULL_TREE; - if (TREE_CODE (base) == ARRAY_REF) - { - while (TREE_CODE (base) == ARRAY_REF) - base = TREE_OPERAND (base, 0); - if (TREE_CODE (base) != COMPONENT_REF - || TREE_CODE (TREE_TYPE (base)) != ARRAY_TYPE) - return NULL_TREE; - } - else if (TREE_CODE (base) == INDIRECT_REF - && TREE_CODE (TREE_OPERAND (base, 0)) == COMPONENT_REF - && (TREE_CODE (TREE_TYPE (TREE_OPERAND (base, 0))) - == REFERENCE_TYPE)) - base = TREE_OPERAND (base, 0); - base = get_inner_reference (base, &bitsize, &bitpos, &offset, &mode, &unsignedp, &reversep, &volatilep); @@ -9116,11 +9102,17 @@ build_struct_group (struct gimplify_omp_ctx *ctx, poly_offset_int coffset; poly_int64 cbitpos; tree base_ind, base_ref, tree_coffset; + tree ocd = OMP_CLAUSE_DECL (c); bool openmp = !(region_type & ORT_ACC); - tree base = extract_base_bit_offset (OMP_CLAUSE_DECL (c), &base_ind, - &base_ref, &cbitpos, &coffset, - &tree_coffset, openmp); + while (TREE_CODE (ocd) == ARRAY_REF) + ocd = TREE_OPERAND (ocd, 0); + + if (TREE_CODE (ocd) == INDIRECT_REF) + ocd = TREE_OPERAND (ocd, 0); + + tree base = extract_base_bit_offset (ocd, &base_ind, &base_ref, &cbitpos, + &coffset, &tree_coffset, openmp); bool do_map_struct = (base == decl && !tree_coffset); @@ -9347,9 +9339,23 @@ build_struct_group (struct gimplify_omp_ctx *ctx, poly_offset_int offset; poly_int64 bitpos; tree tree_offset; - tree base = extract_base_bit_offset (sc_decl, NULL, NULL, - &bitpos, &offset, - &tree_offset, openmp); + + if (TREE_CODE (sc_decl) == ARRAY_REF) + { + while (TREE_CODE (sc_decl) == ARRAY_REF) + sc_decl = TREE_OPERAND (sc_decl, 0); + if (TREE_CODE (sc_decl) != COMPONENT_REF + || TREE_CODE (TREE_TYPE (sc_decl)) != ARRAY_TYPE) + break; + } + else if (TREE_CODE (sc_decl) == INDIRECT_REF + && TREE_CODE (TREE_OPERAND (sc_decl, 0)) == COMPONENT_REF + && (TREE_CODE (TREE_TYPE (TREE_OPERAND (sc_decl, 0))) + == REFERENCE_TYPE)) + sc_decl = TREE_OPERAND (sc_decl, 0); + + tree base = extract_base_bit_offset (sc_decl, NULL, NULL, &bitpos, + &offset, &tree_offset, openmp); if (!base || !operand_equal_p (base, decl, 0)) break; if (scp)
reply other threads:[~2021-06-07 13:46 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210607134636.B4ED63833002@sourceware.org \ --to=jules@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).