public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: Peter Bergner <bergner@linux.ibm.com>,
	Richard Biener <richard.guenther@gmail.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>, "Martin Liška" <mliska@suse.cz>
Subject: Re: [PATCH] middle-end: Skip initialization of opaque type register variables [PR103127]
Date: Mon, 29 Nov 2021 22:56:12 +0000	[thread overview]
Message-ID: <B059F36C-5B20-4F4D-A7BD-1AAEF3D8E6B8@oracle.com> (raw)
In-Reply-To: <ccb5f603-5c1f-0e59-31d9-07251f81e0aa@linux.ibm.com>

Peter,

Thanks a lot for the patch.

Richard, how do you think of the patch?

(The major concern for me is:
	
	With the current patch proposed by Peter, we will generate the call to .DEFERRED_INIT for a variable with OPAQUE_TYPE during gimplification phase,
         However, if this variable is in register, then the call to .DEFERRED_INIT will NOT be expanded during RTL expansion phase.  This unexpanded call to .DEFERRED_INIT might cause some potential IR issue later?

         If the above is a real issue, should we skip initialization for all OPAQUE_TYPE variables even when they are in memory and can be initialized with memset?
	    then we should update “is_var_need_auto_init” in gimplify.c instead.   However, the issue with this approach is, we might miss the opportunity to initialize an OPAQUE_TYPE variable if it will be in memory?
).

Thanks.

Qing


> On Nov 29, 2021, at 3:56 PM, Peter Bergner <bergner@linux.ibm.com> wrote:
> 
> Sorry for dropping the ball on testing the patch from the bugzilla!
> 
> The following patch fixes the ICE reported in the bugzilla on the pre-existing
> gcc testsuite test case, bootstraps and shows no testsuite regressions
> on powerpc64le-linux.  Ok for trunk?
> 
> Peter
> 
> 
> For -ftrivial-auto-var-init=*, skip initializing the register variable if it
> is an opaque type, because CONST0_RTX(mode) is not defined for opaque modes.
> 
> gcc/
> 	PR middle-end/103127
> 	* internal-fn.c (expand_DEFERRED_INIT): Skip if VAR_TYPE is opaque.
> 
> diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
> index 0cba95411a6..7cc0e9d5293 100644
> --- a/gcc/internal-fn.c
> +++ b/gcc/internal-fn.c
> @@ -3070,6 +3070,10 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
>     }
>   else
>     {
> +      /* Skip variables of opaque types that are in a register.  */
> +      if (OPAQUE_TYPE_P (var_type))
> +	return;
> +
>       /* If this variable is in a register use expand_assignment.
> 	 For boolean scalars force zero-init.  */
>       tree init;


  reply	other threads:[~2021-11-29 22:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 21:56 Peter Bergner
2021-11-29 22:56 ` Qing Zhao [this message]
2021-11-30  8:37   ` Richard Biener
2021-11-30 15:14     ` Peter Bergner
2021-11-30 17:51       ` Qing Zhao
2021-11-30 18:08         ` Peter Bergner
2021-11-30 19:50           ` Qing Zhao
2021-11-30 20:07             ` Peter Bergner
2021-11-30 20:44               ` Qing Zhao
2021-11-30 22:35                 ` Peter Bergner
2021-12-01  9:01                   ` Richard Biener
2021-12-01 15:06                     ` Qing Zhao
2021-12-01 16:08                       ` Peter Bergner
2021-12-01 17:42                     ` Peter Bergner
2021-12-01 19:07                       ` Richard Biener
2021-12-01 19:29                         ` Peter Bergner
2021-11-30 17:59     ` 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=B059F36C-5B20-4F4D-A7BD-1AAEF3D8E6B8@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.com \
    /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).