From: Richard Biener <rguenther@suse.de>
To: Martin Jambor <mjambor@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] SRA: Force gimple operand in an additional corner case (PR 112822)
Date: Tue, 12 Dec 2023 18:17:05 +0100 [thread overview]
Message-ID: <C8120926-4C8E-49D5-82F1-FE927A93E2B0@suse.de> (raw)
In-Reply-To: <ri6wmtjcqlw.fsf@>
> Am 12.12.2023 um 17:50 schrieb Martin Jambor <mjambor@suse.cz>:
>
> Hi,
>
> PR 112822 revealed a corner case in load_assign_lhs_subreplacements
> where it creates invalid gimple: an assignment where on the LHS there
> is a complex variable which however is not a gimple register because
> it has partial defs and on the right hand side there is a
> VIEW_CONVERT_EXPR. This patch invokes force_gimple_operand_gsi on
> such statements (like it already does when both sides of a generated
> assignment have partial definitions.
>
> I've made sure the patch passes bootstrap and testsuite on x86_64-linux,
> the bug reporter was kind enough to also check the same on an
> powerpc64le-linux (see bugzilla comment #8).
>
> The testcase has reasonable size but it is specific to ppc64le and its
> altivec vectors. My plan is to ask the bug reporter to massage it into
> a target specific testcase in bugzilla. Alternatively I can try to
> craft a testcase from scratch but that will take time.
>
> Despite the above, is the patch OK for master?
Ok
Richard
>
> Thanks,
>
> Martin
>
>
>
> gcc/ChangeLog:
>
> 2023-12-12 Martin Jambor <mjambor@suse.cz>
>
> PR tree-optimization/112822
> * tree-sra.cc (load_assign_lhs_subreplacements): Invoke
> force_gimple_operand_gsi also when LHS has partial stores and RHS is a
> VIEW_CONVERT_EXPR.
> ---
> gcc/tree-sra.cc | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
> index 3bd0c7a9af0..99a1b0a6d17 100644
> --- a/gcc/tree-sra.cc
> +++ b/gcc/tree-sra.cc
> @@ -4219,11 +4219,15 @@ load_assign_lhs_subreplacements (struct access *lacc,
> if (racc && racc->grp_to_be_replaced)
> {
> rhs = get_access_replacement (racc);
> + bool vce = false;
> if (!useless_type_conversion_p (lacc->type, racc->type))
> - rhs = fold_build1_loc (sad->loc, VIEW_CONVERT_EXPR,
> - lacc->type, rhs);
> + {
> + rhs = fold_build1_loc (sad->loc, VIEW_CONVERT_EXPR,
> + lacc->type, rhs);
> + vce = true;
> + }
>
> - if (racc->grp_partial_lhs && lacc->grp_partial_lhs)
> + if (lacc->grp_partial_lhs && (vce || racc->grp_partial_lhs))
> rhs = force_gimple_operand_gsi (&sad->old_gsi, rhs, true,
> NULL_TREE, true, GSI_SAME_STMT);
> }
> --
> 2.43.0
>
next prev parent reply other threads:[~2023-12-12 17:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 16:50 Martin Jambor
2023-12-12 17:17 ` Richard Biener [this message]
2023-12-12 18:45 ` Peter Bergner
2023-12-12 18:51 ` Peter Bergner
2023-12-12 19:26 ` Richard Biener
2023-12-12 22:50 ` Peter Bergner
2023-12-13 2:36 ` Jason Merrill
2023-12-13 5:26 ` Peter Bergner
2023-12-13 7:51 ` Richard Biener
2023-12-13 8:05 ` Jakub Jelinek
2023-12-13 14:21 ` Peter Bergner
2023-12-13 16:24 ` Jason Merrill
2023-12-13 16:26 ` Jakub Jelinek
2023-12-13 19:23 ` Jason Merrill
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=C8120926-4C8E-49D5-82F1-FE927A93E2B0@suse.de \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
/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: link
Be 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).