From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37948 invoked by alias); 24 Jun 2019 16:10:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 37937 invoked by uid 89); 24 Jun 2019 16:10:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jun 2019 16:10:58 +0000 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 6C5F02B; Mon, 24 Jun 2019 09:10:56 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CFC7A3F71E; Mon, 24 Jun 2019 09:10:55 -0700 (PDT) From: Richard Sandiford To: Segher Boessenkool Mail-Followup-To: Segher Boessenkool ,Jakub Jelinek , , richard.sandiford@arm.com Cc: Jakub Jelinek , Subject: Re: [PATCH 0/3] RFC: Let debug stmts influence codegen at -Og References: <20190624142834.GL815@tucnak> <20190624143639.GG7313@gate.crashing.org> Date: Mon, 24 Jun 2019 16:10:00 -0000 In-Reply-To: <20190624143639.GG7313@gate.crashing.org> (Segher Boessenkool's message of "Mon, 24 Jun 2019 09:36:39 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-06/txt/msg01475.txt.bz2 Segher Boessenkool writes: > On Mon, Jun 24, 2019 at 04:28:34PM +0200, Jakub Jelinek wrote: >> On Sun, Jun 23, 2019 at 02:51:06PM +0100, Richard Sandiford wrote: >> > What do you think? Is it worth pursuing this further? >> >> Wouldn't it be more useful to just force all automatic variables to be >> used at the end of their corresponding scope? This is what patch 2 does FWIW. >> That is IMHO the main issue >> with -Og debugging, VTA is a best effort, if we can express a variable with >> some expression, nice, but if there is no expression nor memory nor register >> that holds the value, we are out of luck. Could be some magic stmt like >> gimple_clobber or ifn or something similar, which would make sure that at >> least until expansion to RTL we force those vars to be live in either a >> register or memory. >> I'm afraid having different modes, one in which debug stmts can't and one >> where they can affect code generation might be a maintainance nightmare. Very few places need to check for the mode explicitly. Most code just uses a new test instead of (rather than on top of) is_gimple_debug/ NONDEBUG_INSN_P. The vast majority of the existing tests for is_gimple_debug aren't interested in the debug contents of a debug stmt. They're just interested in whether the stmt is allowed to affect codegen. With this series that becomes a new predicate in its own right. We then only use is_gimple_debug if we want to process the contents of a debug insn in a particular way, just like we only test for gimple calls or assignments when we're interested in their contents. Old habits die hard of course, so there'd definitely be a period while people instinctively use is_gimple_debug/NONDEBUG_INSN_P instead of the new test. > This is pretty much exactly what USE in RTL is? Maybe use a similar name > in Gimple? Yeah, I wondered about doing it that way, but one problem with USE is that it isn't clear why the USE is there or what the ordering constraints on it are. Here we want the same rules as for normal debug stmts (as modified by patch 1). Also, if the final value ends up being constant, it's fine to propagate that value into the debug stmt that marks the end of the scope. I'm not sure it's valid to propagate constants into a use. But the rtl side of patch 2 (using debug insns instead of USEs) is only a small change. The main part of it is on the gimple side. Unless we prevent all user values from becoming gimple registers and being rewritten into SSA, we'd still need something like the gimple side of patch 2 to ensure that there's sufficient tracking of the variable. Thanks, Richard