From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 2A683385802D for ; Fri, 15 Oct 2021 14:21:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A683385802D Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-569-Q1mMEe6tP4GwVo6I59J7iw-1; Fri, 15 Oct 2021 10:21:05 -0400 X-MC-Unique: Q1mMEe6tP4GwVo6I59J7iw-1 Received: by mail-wr1-f70.google.com with SMTP id y12-20020a056000168c00b00160da4de2c7so6006422wrd.5 for ; Fri, 15 Oct 2021 07:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=N7PpbeeyvAk67NI3i16HgDFi2e4KyBmwapdmwvve1mY=; b=ZYFukG7rMvJN4cq+Z/RuCcRDhlXWcsw1mtzZ3rVENu/Ok2pR36YfvskJ3iNtScxusf nf6ZF/xzE+xOIHgG/D9iXU1yysmvkmvYKjc+5RPo/Ib5h1u0mCBxIITR7tSU/uexhjY6 XEwuYG2f20yR+/82Z8SsUlzqFxTqRyv2dIDL3AwifH/mxPxQpHVKgZhYwcz7AqnH9S/2 rWw9L76WZFRBAsPnY1/8cbE+0BWzeKT+GrjK1yl72RjRWMnzVkYtm30YejVVwBzKBxCb RHSoIyVsXGkad10HOQG4y9aXoDQE1ApkrchZMP5T8zuv1ufT2siK7U2SOXiqLoUFFsZM vzOQ== X-Gm-Message-State: AOAM532JPq8tTsoqKYI0aRgUmq+7D1aBghaZRHZdAvSnKxwRf0qxvQjg g0mc4YBgYWVNL2/2FsLcD/SSVBpWZiqUYzFyPUpqhlrirDY+K4g+myUlvXrDtS7kJtvXLgTe+9X OJ0zEcMgehongbFSfow== X-Received: by 2002:a7b:c258:: with SMTP id b24mr25867237wmj.160.1634307664427; Fri, 15 Oct 2021 07:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxdjYn193/b60MMBk4xcmIAAc9CN6X/UDwgMyvcUDvzGGOnhpnYYgtdJvv/hrViSqzJqxAqw== X-Received: by 2002:a7b:c258:: with SMTP id b24mr25867212wmj.160.1634307664189; Fri, 15 Oct 2021 07:21:04 -0700 (PDT) Received: from abulafia.quesejoda.com ([139.47.33.227]) by smtp.gmail.com with ESMTPSA id q3sm4645174wmc.25.2021.10.15.07.21.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Oct 2021 07:21:03 -0700 (PDT) Subject: Re: [PATCH] Ranger : Do not process abnormal ssa-names. To: Andrew MacLeod , gcc-patches , Richard Biener , Jakub Jelinek , Jeff Law References: <65efdb72-260a-e5a3-5b28-f536f86bd5e6@redhat.com> From: Aldy Hernandez Message-ID: <11c441c6-5f23-d479-d7c0-3cefd57e27d8@redhat.com> Date: Fri, 15 Oct 2021 16:21:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <65efdb72-260a-e5a3-5b28-f536f86bd5e6@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 15 Oct 2021 14:21:08 -0000 On 10/15/21 3:50 PM, Andrew MacLeod wrote: > I've been looking at the pathological time issue ranger has with the > testcase from, uuuuuh..  PR 97623 I think.  I've lost the details, but > kept the file since it was showing unpleasant behaviour. > > Most of the time is spent in callbacks from substitute_and_fold to > value_on_edge()  dealing with PHI results and arguments.  Turns out, its > virtually all wasted time dealing with SSA_NAMES with the > OCCURS_IN_ABNORMAL_PHI flag set.. > > This patch tells ranger not to consider any SSA_NAMEs which occur in > abnormal PHIs.  This reduces the memory footprint of all the caches, and > also has a ripple effect with the new threader code which uses the GORI > exports and imports tables, making it faster as well as no ssa-name with > the abnormal flag set will be entered into the tables. > > That alone was not quite enough, as all the sheer volume of call backs > still took time,  so I added checks in the value_of_* class of routines > used by substitute_and_fold to indicate there is no constant value > available for any SSA_NAME with that flag set. > > On my x86_64 box, before this change, that test case looked like: > > tree VRP                           :   7.76 (  4%)   0.23 ( 5%)   8.02 > (  4%)   537k (  0%) > tree VRP threader                  :   7.20 (  4%)   0.08 (  2%) 7.28 ( > 4%)   392k (  0%) > tree Early VRP                     :  39.22 ( 22%)   0.07 (  2%) 39.44 ( > 22%)  1142k (  0%) > > And with this patch , the results are: > >  tree VRP                           :   7.57 (  6%)   0.26 ( 5%)   7.85 > (  6%)   537k (  0%) >  tree VRP threader                  :   0.62 (  0%)   0.02 ( 0%)   0.65 > (  0%)   392k (  0%) >  tree Early VRP                     :   4.00 (  3%)   0.01 ( 0%)   4.03 > (  3%)  1142k (  0%) > > Which is a significant improvement, both for EVRP and the threader.. > > The patch adjusts the ranger folder, as well as the hybrid folder. > > bootstrapped on x86_64-pc-linux-gnu with no regressions and no missed > cases that I have been able to find. > > I don't want to push it quite yet as I wanted feedback to make sure we > don't actually do anything I'm not aware of with SSA_NAMES which have > the ABNORMAL_PHI flag set.  Most of the code i can find in VRP and > vr-values appears to punt, so I presume not even considering those names > is fine? The backward threader skips both edges with EDGE_ABNORMAL set as well as phi results to have SSA_NAME_OCCURS_IN_ABNORMAL_PHI. The forward threader skips out on all abnormal edges as well. It seems to even avoid threading through blocks where one of the 2 outgoing edges is abnormal. Dunno if this was an oversight, or just being extra careful. Anywhoooo, at least from the threaders you're safe. Aldy