From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 9AB8E3896C00 for ; Tue, 18 May 2021 09:58:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9AB8E3896C00 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E9A71FB; Tue, 18 May 2021 02:58:08 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD4153F719; Tue, 18 May 2021 02:58:07 -0700 (PDT) From: Richard Sandiford To: Richard Biener Mail-Followup-To: Richard Biener , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Avoid setting TREE_ADDRESSABLE on stack vars during RTL expansion References: <80p16ss1-o961-1r5p-rpss-45r4n1so371o@fhfr.qr> Date: Tue, 18 May 2021 10:58:06 +0100 In-Reply-To: <80p16ss1-o961-1r5p-rpss-45r4n1so371o@fhfr.qr> (Richard Biener's message of "Tue, 18 May 2021 11:41:13 +0200 (CEST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, 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 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: Tue, 18 May 2021 09:58:09 -0000 Richard Biener writes: > @@ -6621,9 +6637,31 @@ pass_expand::execute (function *fun) > (int) param_ssp_buffer_size); > } > > + /* Temporarily mark PARM_DECLs and RESULT_DECLs we need to expand to > + memory addressable so expand_function_start can emit the required > + copies. */ > + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm; > + parm = DECL_CHAIN (parm)) > + if (bitmap_bit_p (forced_stack_vars, DECL_UID (parm))) > + TREE_ADDRESSABLE (parm) = 1; > + if (DECL_RESULT (current_function_decl) > + && bitmap_bit_p (forced_stack_vars, > + DECL_UID (DECL_RESULT (current_function_decl)))) > + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 1; > + > /* Set up parameters and prepare for return, for the function. */ > expand_function_start (current_function_decl); > > + /* Clear TREE_ADDRESSABLE again. */ > + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm; > + parm = DECL_CHAIN (parm)) > + if (bitmap_bit_p (forced_stack_vars, DECL_UID (parm))) > + TREE_ADDRESSABLE (parm) = 0; > + if (DECL_RESULT (current_function_decl) > + && bitmap_bit_p (forced_stack_vars, > + DECL_UID (DECL_RESULT (current_function_decl)))) > + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 0; > + > /* If we emitted any instructions for setting up the variables, > emit them before the FUNCTION_START note. */ > if (var_seq) Is TREE_ADDRESSABLE guaranteed to be 0 for these decls before the code is hit? I was surprised that we didn't need to protect against net 1->0 transitions. Thanks, Richard