From patchwork Sat Jun 22 18:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1951117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=GFdRs/mC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W63PL29JPz1ydW for ; Sun, 23 Jun 2024 04:57:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FEE8385DDE1 for ; Sat, 22 Jun 2024 18:57:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by sourceware.org (Postfix) with ESMTPS id EA7F83858402 for ; Sat, 22 Jun 2024 18:56:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA7F83858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EA7F83858402 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082572; cv=none; b=b59SbSWhD61swFvnsTPZS2RfL3AnHyPuBCI05Y6Fwa+sALvgoOGR7Nd8SfVx/upsusXvjHzxEClpn3dBaCduDimPNU45ez3QBQVpuJlEKRJbyeA49ytqvWOYCgvrgUWDzFftrKTvaM3hkJPqAwLC42mkjZ2FRyPdMS8+RcCYSJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719082572; c=relaxed/simple; bh=In43EDRnEajTO/SMb+TFU4pTRZIHRDr+gpjAS5ZYYL4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ogr6tWhbr+NaTEDOBEuHrcGYEk8Cy8U/W0yH+T3JvzESsdC2GW1xpwzKTY81rPn9I/XhSsizNKO0fV51ZJNg8l4ckPSCuEGlmvKE+Gwn2l9/xJ3uOFmJNnn2azmDRdBNpjDnAZlJg05Mq46ypuECdbTIhMKQNW2iPbf4MY/GJaY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719082571; x=1750618571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=In43EDRnEajTO/SMb+TFU4pTRZIHRDr+gpjAS5ZYYL4=; b=GFdRs/mC8weMsj+jsPga1JwwGx9O6auHTFcz40ZIoXPUPE/xxTP77aY4 C6W+BFC/bUMh472KkzYTI+/d+oBP4qL+ckgSS9U6H25us5XmGuHDqzWqH yRkZ+5btZtP+rxX+rm+S6kdGEQVNV96lsLBV/tY5ZjJvpFuTKw7zs4DHd wG3S4JuxfKLJXbEOCIJdUPUu/BcrrRImxArfQ4839zdtR1QV9SO8w/Ngj f7zJb+93tJyPi9jL7rPE34gEaYtFOkjbHdUPBZS+0JMywJmiyOWA3YSXR RGVzIy0f5uWsSXlWRZT6R8eIrnb7VHEHodbVoI+Fk3mp6z7QxYgidiuNO Q==; X-CSE-ConnectionGUID: sPvAgl4kSia+haEuJR4/4A== X-CSE-MsgGUID: UUzV53QPTYej5T8l2Lovng== X-IronPort-AV: E=McAfee;i="6700,10204,11111"; a="16216438" X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="16216438" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:05 -0700 X-CSE-ConnectionGUID: MKTdHNRGTLy9AqDyLwcc+A== X-CSE-MsgGUID: hDQ2csU/T46GB/GduXDJ3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,258,1712646000"; d="scan'208";a="42968332" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2024 11:56:04 -0700 From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH v8 02/12] Fix pro_and_epilogue for sibcalls at -O0 Date: Sat, 22 Jun 2024 11:54:34 -0700 Message-ID: <20240622185557.1589179-3-ak@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240622185557.1589179-1-ak@linux.intel.com> References: <20240622185557.1589179-1-ak@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Some of the cfg fixups in pro_and_epilogue for sibcalls were dependent on "optimize". Make them check cfun->tail_call_marked instead to handle the -O0 musttail case. This fixes the musttail test cases on arm targets. PR115255 gcc/ChangeLog: * function.cc (thread_prologue_and_epilogue_insns): Check cfun->tail_call_marked for sibcalls too. (rest_of_handle_thread_prologue_and_epilogue): Dito. --- gcc/function.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/function.cc b/gcc/function.cc index 4edd4da12474..7c9b181423d4 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -6261,6 +6261,7 @@ thread_prologue_and_epilogue_insns (void) /* Threading the prologue and epilogue changes the artificial refs in the entry and exit blocks, and may invalidate DF info for tail calls. */ if (optimize + || cfun->tail_call_marked || flag_optimize_sibling_calls || flag_ipa_icf_functions || in_lto_p) @@ -6557,7 +6558,7 @@ rest_of_handle_thread_prologue_and_epilogue (function *fun) { /* prepare_shrink_wrap is sensitive to the block structure of the control flow graph, so clean it up first. */ - if (optimize) + if (cfun->tail_call_marked || optimize) cleanup_cfg (0); /* On some machines, the prologue and epilogue code, or parts thereof,