From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id A7DD53890023 for ; Mon, 3 Jun 2024 17:02:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7DD53890023 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7DD53890023 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717434123; cv=none; b=xehgPSGx9qWTSNjZVvqFWJUPQ+s0Ljd2Pu/YnIqG8dHxF+Sjx8Yagjl54U+f2NXKHLpr80A7ZakSWWA3BiYahdeU9PTrWXv0l1lk2IyCHsBb4Pfh5sHdSuAl9H2NrCsg06RSh/DjoigASyCI8LNSgEVnH9oDxJT2Chej1LtsLN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717434123; c=relaxed/simple; bh=uM+psnhcwc45PkMX9tOnpjtKwwi9V4MlV3Fn/S078Qc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=KqPqkyTliO++j28xM447y9uXAi6WWoKsWnLGWMjt5SzOp9Z/vSqf4NuwapolqvPrTSe3zU/UOeFdDcn10AStB3a9UJ+auP0QQ8LUX0nEC2KpwmS+xFdcvl9RtBv8/bUnoVzF3D849nvi4fAoZ6+GW27CJ9C1pFXm+HtV8+9QaNs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from knuth.suse.de (unknown [10.168.5.16]) by smtp-out1.suse.de (Postfix) with ESMTP id 90796218E7; Mon, 3 Jun 2024 17:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1717434120; 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=vMJnsjHsuOnmZFKd5Y+BfFccyRDEmzAYkxZcwTO69lA=; b=cQXk5CI0UGCUDRveaEXtsFv6juwjTxiu+C+nbK7WJeKFJSFXUJXWEjhtGuQ46EJQxVdILS kl40zEfa1R3uFsrBI5NcO2kh5LUNnslUz2F5JQa/zj6Qh7E77KqOkCd2VuLm50zDnJHjmh kgimbP4h9YtWFhaov8Kwzum5MhLwzmQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1717434120; 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=vMJnsjHsuOnmZFKd5Y+BfFccyRDEmzAYkxZcwTO69lA=; b=Y9JN05XSba6l9LXZa9zTMhB2ixhse1A8GQ62YV/up4YdGr7+IZfl2c85lNEQxBujfhnAza LvQvgSEjJwQzPNDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1717434120; 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=vMJnsjHsuOnmZFKd5Y+BfFccyRDEmzAYkxZcwTO69lA=; b=cQXk5CI0UGCUDRveaEXtsFv6juwjTxiu+C+nbK7WJeKFJSFXUJXWEjhtGuQ46EJQxVdILS kl40zEfa1R3uFsrBI5NcO2kh5LUNnslUz2F5JQa/zj6Qh7E77KqOkCd2VuLm50zDnJHjmh kgimbP4h9YtWFhaov8Kwzum5MhLwzmQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1717434120; 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=vMJnsjHsuOnmZFKd5Y+BfFccyRDEmzAYkxZcwTO69lA=; b=Y9JN05XSba6l9LXZa9zTMhB2ixhse1A8GQ62YV/up4YdGr7+IZfl2c85lNEQxBujfhnAza LvQvgSEjJwQzPNDQ== Received: by knuth.suse.de (Postfix, from userid 10510) id 7F70E386767; Mon, 3 Jun 2024 19:02:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by knuth.suse.de (Postfix) with ESMTP id 6C16D386766; Mon, 3 Jun 2024 19:02:00 +0200 (CEST) Date: Mon, 3 Jun 2024 19:02:00 +0200 (CEST) From: Michael Matz To: Andi Kleen cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: [PATCH v6 1/8] Improve must tail in RTL backend In-Reply-To: Message-ID: References: <20240521143203.2893096-1-ak@linux.intel.com> <20240521143203.2893096-2-ak@linux.intel.com> <357aa546-91d8-8d98-f941-ac2bdafab656@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Score: -4.19 X-Spam-Level: X-Spamd-Result: default: False [-4.19 / 50.00]; BAYES_HAM(-2.99)[99.96%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; FREEMAIL_CC(0.00)[gcc.gnu.org,gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TAGGED_RCPT(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_SOME(0.00)[] X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hello, On Fri, 31 May 2024, Andi Kleen wrote: > > I think the ultimate knowledge if a call can or cannot be implemented as > > tail-call lies within calls.cc/expand_call: It is inherently > > target and ABI specific how arguments and returns are layed out, how the > > stack frame is generated, if arguments are or aren't removed by callers > > or callees and so on; all of that being knowledge that tree-tailcall > > doesn't have and doesn't want to have. As such tree-tailcall should > > not be regarded as ultimate truth, and failures of tree-tailcall to > > recognize something as tail-callable shouldn't matter. > > It's not the ultimate truth, but some of the checks it does are not > duplicated at expand time nor the backend. So it's one necessary pre > condition with the current code base. > > Yes maybe the checks could be all moved, but that's a much larger > project. Hmm. I count six tests in about 25 lines of code in tree-tailcall.cc:suitable_for_tail_opt_p and suitable_for_tail_call_opt_p. Are you perhaps worrying about the sibcall discovery itself (i.e. much of find_tail_calls)? Why would that be needed for musttail? Is that attribute sometimes applied to calls that aren't in fact sibcall-able? One thing I'm worried about is the need for a new sibcall pass at O0 just for sibcall discovery. find_tail_calls isn't cheap, because it computes live local variables for the whole function, potentially being quadratic. Ciao, Michael.