From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 813C73857012 for ; Mon, 7 Jun 2021 07:50:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 813C73857012 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 90B7A21A83; Mon, 7 Jun 2021 07:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623052254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eZ2RJyvFCNDgGuzK/SyW152W+sT8nPx8iqQTjKKH/r4=; b=PpMeJqv9SLghYMwMH9Kbtk5JPKQCLMDHq6TjHDRLFyf1UzNfbvxbEaiv81s21Xg7J3UNwY xtRVtCPh/A9RwWxtMiYwmxJ2c0ACWcm0lRkLICeJX29IyRuqLrcJbZC9JD5O8pM1zKgoiE 0fdPPFMIpCgzvAZmAa/pyLrgvtVSAWI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623052254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eZ2RJyvFCNDgGuzK/SyW152W+sT8nPx8iqQTjKKH/r4=; b=3bPMb3d/m9qCtbSG0wrWV61JwdZlecj/dJYXBQEijTH4jgjJ3OyboMnTBtzMHwS+vSDqVm LRTvtpFRR5GKcTDw== Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8A4B9A3B85; Mon, 7 Jun 2021 07:50:54 +0000 (UTC) Date: Mon, 7 Jun 2021 09:50:54 +0200 (CEST) From: Richard Biener To: Qing Zhao cc: richard Sandiford , kees Cook , gcc-patches Qing Zhao via Subject: Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc In-Reply-To: <94359448-0233-4D6A-BAD4-F51524659018@oracle.com> Message-ID: References: <52959802-6AF1-4BFC-B984-3BC495C535BD@ORACLE.COM> <94359448-0233-4D6A-BAD4-F51524659018@oracle.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 07:51:05 -0000 On Thu, 3 Jun 2021, Qing Zhao wrote: > Hi, Richard, > > For the following, I need more clarification: > > > > +/* Expand the IFN_DEFERRED_INIT function according to its second > argument. */ > +static void > +expand_DEFERRED_INIT (internal_fn, gcall *stmt) > +{ > + tree var = gimple_call_lhs (stmt); > + tree init = NULL_TREE; > + enum auto_init_type init_type > + = (enum auto_init_type) TREE_INT_CST_LOW (gimple_call_arg (stmt, 1)); > + > + switch (init_type) > + { > + default: > + gcc_unreachable (); > + case AUTO_INIT_PATTERN: > + init = build_pattern_cst_for_auto_init (TREE_TYPE (var)); > + expand_assignment (var, init, false); > + break; > + case AUTO_INIT_ZERO: > + init = build_zero_cst (TREE_TYPE (var)); > + expand_assignment (var, init, false); > + break; > + } > > I think actually building build_pattern_cst_for_auto_init can generate > massive garbage and for big auto vars code size is also a concern and > ideally on x86 you'd produce rep movq. So I don't think going > via expand_assignment is good. Instead you possibly want to lower > .DEFERRED_INIT to MEMs following expand_builtin_memset and > eventually enhance that to allow storing pieces larger than a byte. > > > I will lower .DEFFERED_INIT to MEMS following expand_builtin_memset for “AUTO_INIT_PATTERN”. > My question is: > Do I need to do the same for “AUTO_INIT_ZERO”? No, the representation for a general "zero constant" for aggregates is just a single CONSTRUCTOR node with zero explicit elements and thus quite optimal. Richard. > Thanks. > > Qing >