From: Qing Zhao <qing.zhao@oracle.com>
To: Richard Biener <rguenther@suse.de>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] middle-end/102587 - avoid auto-init for VLA vectors
Date: Mon, 4 Oct 2021 17:00:10 +0000 [thread overview]
Message-ID: <A878B6BA-DBF8-4512-BE1A-798990F2A1D3@oracle.com> (raw)
In-Reply-To: <1q7r9sp5-587n-90p9-r3qo-n580o833820@fhfr.qr>
I have several questions on this fix:
1. This fix avoided expanding “.DEFERRED_INIT” when !tree_fits_uhwi_p (TYPE_SIZE_UNIT (var_type)).
As a result, this call to .DEFERRED_INIT will NOT be expanded at all.
Then not expanding .DEFERRED_INIT in RTL expanding phase will trigger more issues in later RTL phases, this looks not correct to me. (Actually, with is the patch, this testing case still failed in a later RTL stage).
So, If we really want to avoid auto-init for VLA vectors, we should not add call to .DEFERRED_INIT in gimplification phase at all.
2. For the added .DEFERRED_INIT:
__SVFloat64_t f64;
f64 = .DEFERRED_INIT (POLY_INT_CST [16, 16], 2, 0);
What does “POLY_INT_CST[16,16]” mean? Is this a constant size? If YES, what’s the value of it? If Not, can we use “memset” to expand it?
Thanks.
Qing
> On Oct 4, 2021, at 3:57 AM, Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> This avoids ICEing for VLA vector auto-init by not initializing.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
>
> 2021-10-04 Richard Biener <rguenther@suse.de>
>
> PR middle-end/102587
> * internal-fn.c (expand_DEFERRED_INIT): Guard register
> initialization path an avoid initializing VLA registers
> with it.
>
> * gcc.target/aarch64/sve/pr102587-1.c: New testcase.
> * gcc.target/aarch64/sve/pr102587-2.c: Likewise.
> ---
> gcc/internal-fn.c | 3 ++-
> gcc/testsuite/gcc.target/aarch64/sve/pr102587-1.c | 4 ++++
> gcc/testsuite/gcc.target/aarch64/sve/pr102587-2.c | 4 ++++
> 3 files changed, 10 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr102587-1.c
> create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr102587-2.c
>
> diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
> index 8312d08aab2..ef5dc90db56 100644
> --- a/gcc/internal-fn.c
> +++ b/gcc/internal-fn.c
> @@ -3035,7 +3035,8 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
> /* Expand this memset call. */
> expand_builtin_memset (m_call, NULL_RTX, TYPE_MODE (var_type));
> }
> - else
> + /* ??? Deal with poly-int sized registers. */
> + else if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (var_type)))
> {
> /* If this variable is in a register, use expand_assignment might
> generate better code. */
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr102587-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr102587-1.c
> new file mode 100644
> index 00000000000..2b9a68b0b59
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr102587-1.c
> @@ -0,0 +1,4 @@
> +/* { dg-do compile } */
> +/* { dg-options "-ftrivial-auto-var-init=zero" } */
> +
> +void foo() { __SVFloat64_t f64; }
> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr102587-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr102587-2.c
> new file mode 100644
> index 00000000000..4cdb9056002
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr102587-2.c
> @@ -0,0 +1,4 @@
> +/* { dg-do compile } */
> +/* { dg-options "-ftrivial-auto-var-init=pattern" } */
> +
> +void foo() { __SVFloat64_t f64; }
> --
> 2.31.1
next prev parent reply other threads:[~2021-10-04 17:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 8:57 Richard Biener
2021-10-04 17:00 ` Qing Zhao [this message]
2021-10-04 17:19 ` Richard Biener
2021-10-04 17:24 ` Qing Zhao
2021-10-05 6:25 ` Richard Biener
2021-10-05 8:28 ` Richard Sandiford
2021-10-05 8:33 ` Richard Biener
2021-10-05 15:33 ` Qing Zhao
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=A878B6BA-DBF8-4512-BE1A-798990F2A1D3@oracle.com \
--to=qing.zhao@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).