From patchwork Thu Oct 6 17:25:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp424822wrs; Thu, 6 Oct 2022 10:27:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Lwj3SHGZKK+2/3oePv+r+sp+zkVt3tP0T5+ot0ynFjRo11DIfIE6lE159FhfxS62+ymAL X-Received: by 2002:a17:906:fe44:b0:77c:e313:a8e8 with SMTP id wz4-20020a170906fe4400b0077ce313a8e8mr787679ejb.700.1665077228369; Thu, 06 Oct 2022 10:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665077228; cv=none; d=google.com; s=arc-20160816; b=EHI4fqubiUpoRqvH7bE9AtO4DZanKyaCl6dStX5YO+954QmE8cwikXwBwP4GXzgAG2 kDdKAB6cUJBO2VqAKXfzcAT38UmUW+BlyYSBZlxZLrzFQYLVYxdNpP55qZczN3eJFbl/ aTzJtDrz/O6k98xwGpUGHM7hMNpowqG6DVLIIJoUXWl2QDg4N/3Esh7wcQARfl3sjCxO OOO6sw31EPCwK8X3NY1LW7dvWxBvSSLdxWjDcfReoWt+RGmJbZVP23sPp/WLWIyujDg4 AnSLs7rcmKPhJqWFp3KryWVAAsn2WmMAdpHmMf3OMBTyI5IsIZ186ysGqxzCEM17Nqqj ReWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=UeChQin9uCPochsyic8JOVFANh+OrkvKuiCaYgJM8O8=; b=Ji/p7hSLLnmkggwyXBUQhQB2UpM5SohdvHjt6fpL2Jpn4LE/+APl+/oXzsGFoBDb7h i7+XiU+z19NB96Q+wMmR1ciToU1h9JfY04RYFi9r9WVaG/cRr1/6Ao9zJyVL/LSun/m6 3NVHOKmf3cNVGM5sdMRsxDznlqUZ6q96xN+WHy9A2xG2C/2HIXqlDI2JEG7XQrce8jhs rY8gICQ4nV9Q7XGP8cht3J59/576I0ex14uC+V5pDbOyCna+f4C/6muV+9WyTmN/k4GE O01K+y6cKeHoHpswqaXxWVKrV8ncW5zv3UK0FvzHwh21WmzRMCnv8B1A968VoBs0Jon1 pC4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CwcZua9g; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id xc7-20020a170907074700b0078d2197d670si7068121ejb.661.2022.10.06.10.27.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 10:27:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CwcZua9g; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BB49384D14C for ; Thu, 6 Oct 2022 17:27:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BB49384D14C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665077227; bh=UeChQin9uCPochsyic8JOVFANh+OrkvKuiCaYgJM8O8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CwcZua9gBvxbIkrN8HtZV6yEBHyUNZdo6gkB+ejXDr2xGVJ7SXCyBBBQ6c/idj7h8 zmrDpkcXk5vieWdgyGix2L4cvpX4rfKUXfiXTMuSWmUIV0KdDpFFhQcsGc/J8Iy8cM kb24/hxOJwAAlIQB7DIdKDj8woB3+EysdvP57f0w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 9F1833856DC2 for ; Thu, 6 Oct 2022 17:26:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F1833856DC2 Received: by mail-wr1-x42c.google.com with SMTP id u10so3757715wrq.2 for ; Thu, 06 Oct 2022 10:26:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UeChQin9uCPochsyic8JOVFANh+OrkvKuiCaYgJM8O8=; b=4lE3wV2bcXR1jMqVtuaFEFl4UO54HT+a/s4fwwT339LEizz3Ssb6ESVSHbsmzdq2B3 uhjW4nDqxznek47yHesuauBWWlwAiMDcjUN3jNDEXM3nd5+Lqq8N00rSPeMV37Z0gh/S xXA5grBn16beXuQf9Ldc3rwiAn5KPeZtFbcsnf+bv4yTriQ0CXBAJb6seMXXK1xltqi5 c1d9SY+3CBKVIu5E4jArt8CwLWrSMdbKDotoRZYBezFhDxm/7QmXggbzFcIAQUb5FY01 bgODiRz57bdsawHWFplrypyPAH/tYlxf7TO37y6m01HUdyvjapGZz8K1qw5Tt6W5c1jR QzrA== X-Gm-Message-State: ACrzQf3dnYl+AO/o92HV4qoROviFOvM4gmSbxdsHjm+12SHE0psHy3nC fy08oRSyW+cZhRxY/GEHHKGG85V5EPsOuQ== X-Received: by 2002:adf:d1c2:0:b0:22e:6499:3137 with SMTP id b2-20020adfd1c2000000b0022e64993137mr731810wrd.658.1665077182320; Thu, 06 Oct 2022 10:26:22 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id g6-20020a5d4886000000b0022cc6b8df5esm5298wrq.7.2022.10.06.10.26.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 10:26:21 -0700 (PDT) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Reduce DF computation at -O0 Date: Thu, 06 Oct 2022 19:25:53 +0200 Message-ID: <2601473.BddDVKsqQX@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745960019808873382?= X-GMAIL-MSGID: =?utf-8?q?1745960019808873382?= Hi, even at -O0 there may be a fair amount of DF computation performed when compiling large units and part of it appears to be useless. Bootstrapped/regtested on x86-64/Linux, OK for the mainline? 2022-10-06 Eric Botcazou * function.cc (thread_prologue_and_epilogue_insns): Update only entry and exit blocks when not optimizing. Remove dead statement. diff --git a/gcc/function.cc b/gcc/function.cc index 5498a712c4a..6474a663b30 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -6249,10 +6249,15 @@ thread_prologue_and_epilogue_insns (void) } } - /* Threading the prologue and epilogue changes the artificial refs - in the entry and exit blocks. */ - epilogue_completed = 1; - df_update_entry_exit_and_calls (); + /* 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) + df_update_entry_exit_and_calls (); + else + { + df_update_entry_block_defs (); + df_update_exit_block_uses (); + } } /* Reposition the prologue-end and epilogue-begin notes after