From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 5490D3858D37 for ; Mon, 15 Aug 2022 15:22:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5490D3858D37 Received: by mail-pj1-x1032.google.com with SMTP id t22so7211115pjy.1 for ; Mon, 15 Aug 2022 08:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=myJoXgvQANXmT6VZnJN6FCqYB61ftDBVClZSO5VIicw=; b=PxcnAxAAT6QF0be6/t47cbfpwET6Zk77BS4/TyTKHXdRJWholZvi4Kw+MAqICUUuIz TbxKmneN+BIKI6nSsRdzlZO7gTM6ze8Rlq7A7IGloPHMB6cuaobFb4+ci6Mnjx90RDAN XV0Eb8p9nf/WKFiSb2ZwrfbZz2L8r+Za0DC2eWGQeLlUV6HBeoEcsV+nhPf0Vxd2JYEg tdmU461s7aK8GLSEmoKErJ6a65xaZc4Nxan2gfEwlGRGfmdIvbPu2jvu8seuyycYHr2p ir4BwKRWxwNDdJ4p8OEfo0hHizPUVGfQ0u5l7KKBvS5gZi5P1s4Lz0KaR/sJGObb5yLO KzPg== X-Gm-Message-State: ACgBeo0Fm+nfsazdFgIstCSmpW79KUiCK38xxHRKZvMsgTqMs+aLvWiv MZqWT27o/ejr+yD7yy9oEh4= X-Google-Smtp-Source: AA6agR4+xNSVChb+vQ4v9HVJP7xjOuyTF3RZnpSKZoxyJAoR8aOHBNFO/bJ3yJj6kh0R8cMQnE2dEw== X-Received: by 2002:a17:902:aa87:b0:172:689f:106b with SMTP id d7-20020a170902aa8700b00172689f106bmr7774775plr.127.1660576975139; Mon, 15 Aug 2022 08:22:55 -0700 (PDT) Received: from [172.31.0.106] (c-73-98-188-51.hsd1.ut.comcast.net. [73.98.188.51]) by smtp.gmail.com with ESMTPSA id x20-20020aa78f14000000b0052dbad1ea2esm6694731pfr.6.2022.08.15.08.22.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 08:22:54 -0700 (PDT) Message-ID: <2f2c8baf-e92d-4e5f-0e4c-b8369e406ac6@gmail.com> Date: Mon, 15 Aug 2022 09:22:53 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] Support threading of just the exit edge Content-Language: en-US To: Aldy Hernandez , Richard Biener Cc: gcc-patches , "MacLeod, Andrew" References: <20220812120145.91C6513AAE@imap2.suse-dmz.suse.de> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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 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: Mon, 15 Aug 2022 15:22:59 -0000 On 8/12/2022 10:03 AM, Aldy Hernandez wrote: > On Fri, Aug 12, 2022 at 2:01 PM Richard Biener wrote: >> This started with noticing we add ENTRY_BLOCK to our threads >> just for the sake of simplifying the conditional at the end of >> the first block in a function. That's not really threading >> anything but it ends up duplicating the entry block, and >> re-writing the result instead of statically fold the jump. > Hmmm, but threading 2 blocks is not really threading at all?? Unless > I'm misunderstanding something, this was even documented in the > backwards threader: > > [snip] > That's not really a jump threading opportunity, but instead is > simple cprop & simplification. We could handle it here if we > wanted by wiring up all the incoming edges. If we run this > early in IPA, that might be worth doing. For now we just > reject that case. */ > if (m_path.length () <= 1) > return false; My recollection is that code was supposed to filter out the case where the threading path is just a definition block and a use block where the definition block dominated the use block.    For that case, threading isn't really needed as we can just use const/copy propagation to propagate the value from the def to the use which should in turn allow the use (the conditional branch) to be simplified away -- all without the block copying and associated CFG updates. What doesn't make sense to me today is how do we know there's a dominator relationship between the two blocks? Jeff