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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 690F0385803D for ; Thu, 23 Sep 2021 11:07:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 690F0385803D Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-Czs3cJ8kO9qzUdLvpZG-Ng-1; Thu, 23 Sep 2021 07:07:14 -0400 X-MC-Unique: Czs3cJ8kO9qzUdLvpZG-Ng-1 Received: by mail-wr1-f71.google.com with SMTP id f11-20020adfc98b000000b0015fedc2a8d4so4885893wrh.0 for ; Thu, 23 Sep 2021 04:07:13 -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:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=arDwmOA0V2SXE8rj+ty8MgaqvSbCG8Zdx9XnNxC3um8=; b=KV57ov8ymbO2ry4mmTxnGgXPM1NeKduKWxg6LwXURZz9cO3OvsOCpbYRBrUofM5Pj8 b/Sqot9xfL9paT4euGHHhkxGn/HgnFvuNwpRmHl4cYnKvVe+vUB/gs1Vuoq2/kbPuVIH WGIs0eBTmh+1YFl2/S61uUMqwJ/BFmXjyizZQi0LcClGBUIvn8X2nZMJ1rmHoPjmEsqZ IJO+sM8qdbzi/kRVr0edpgfHk0vJQLHWyxynBhJErAaQnEdobpabxHVfT7RUgIrGV3AG 5h6Fb+M/EcgwtTiQ+IZEoknVPZ1HCShpunu+NgB9dkBCVQfOwdadFA+cmmEVs0QCHtYi mIdA== X-Gm-Message-State: AOAM533+bYczvgKmJsXhosB89gCA9d8MResHkdIXwivvMFlzFrH8pdFO Bpx0H8o+XG0ybTDyf5mKmltcyroSofhDhUIfYe4WtAf2elATYIy6hpbZrkch63VhSwo1YAI03D9 6bvS9EpWRoVGoeMZMCofrnVWnKAmlrQa2PaW95Ldnfn/3rdYUGyY5DYFmJugbfOKXsg== X-Received: by 2002:adf:edc7:: with SMTP id v7mr4419302wro.63.1632395232564; Thu, 23 Sep 2021 04:07:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAcGJa3aUP2wQBzT/xeJLos5xU9sXLnL03r1Pd8XyexM5IbCatv7GDXIle/VDKAlter4/vrQ== X-Received: by 2002:adf:edc7:: with SMTP id v7mr4419266wro.63.1632395232215; Thu, 23 Sep 2021 04:07:12 -0700 (PDT) Received: from abulafia.quesejoda.com ([139.47.33.227]) by smtp.gmail.com with ESMTPSA id t126sm8739434wma.4.2021.09.23.04.07.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Sep 2021 04:07:11 -0700 (PDT) Subject: Re: [PATCH 2/7] Do not query SCEV in range_of_phi unless dominators are available. To: Richard Biener Cc: Andrew MacLeod , GCC patches References: <20210921165350.414593-1-aldyh@redhat.com> <20210921165350.414593-3-aldyh@redhat.com> <5b599db2-3c8b-e75e-786b-0ce1d582cbd7@redhat.com> From: Aldy Hernandez Message-ID: Date: Thu, 23 Sep 2021 13:07:10 +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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="------------6902012184F63193E842EF1B" Content-Language: en-US X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: Thu, 23 Sep 2021 11:07:17 -0000 This is a multi-part message in MIME format. --------------6902012184F63193E842EF1B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 9/22/21 10:05 AM, Richard Biener wrote: > On Tue, Sep 21, 2021 at 7:17 PM Aldy Hernandez via Gcc-patches > wrote: >> >> >> >> On 9/21/21 7:05 PM, Andrew MacLeod wrote: >>> On 9/21/21 12:53 PM, Aldy Hernandez wrote: >>>> SCEV won't work without dominators and we can get called without >>>> dominators from debug_ranger. >>>> >>>> Another option would be to rename scev_initialized_p to something like >>>> scev_available_p and move the check there. For now, this will do. >>>> >>>> Committed. >>>> >>>> gcc/ChangeLog: >>>> >>>> * gimple-range-fold.cc (fold_using_range::range_of_phi): Check >>>> dom_info_available_p. >>>> --- >>>> gcc/gimple-range-fold.cc | 4 +++- >>>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc >>>> index 997d02dd4b9..4dbf4188ec2 100644 >>>> --- a/gcc/gimple-range-fold.cc >>>> +++ b/gcc/gimple-range-fold.cc >>>> @@ -781,7 +781,9 @@ fold_using_range::range_of_phi (irange &r, gphi >>>> *phi, fur_source &src) >>>> } >>>> // If SCEV is available, query if this PHI has any knonwn values. >>>> - if (scev_initialized_p () && !POINTER_TYPE_P (TREE_TYPE (phi_def))) >>>> + if (dom_info_available_p (CDI_DOMINATORS) >>>> + && scev_initialized_p () >>>> + && !POINTER_TYPE_P (TREE_TYPE (phi_def))) >>>> { >>>> value_range loop_range; >>>> class loop *l = loop_containing_stmt (phi); >>> >>> Im confused.. if scev doesn't work without dominators, how is >>> scev_initialized_p() true if there are no dominators? Are we >>> initializing it somewhere without dominators? Maybe there should be a >>> check in the scev init routine? seems like something else is amok. >> >> As I mentioned, this can happen from debug_ranger(), which is a >> debugging construct, and I've been known to call it without dominators >> :). And yes, I agree we could move it to scev_initialized_p. > > But why is scev_initialized_p () true from debug_ranger()? This seems to be an artifact of some internal diagnostic code I had comparing the new work with the ASSERT_EXPR threads. I've reverted the patch. Sorry for the noise, and thanks for pointing it out. Aldy --------------6902012184F63193E842EF1B Content-Type: text/x-patch; charset=UTF-8; name="p.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.patch" commit e7797033a8f2bd9bcf455d796178f5c14d457513 Author: Aldy Hernandez Date: Thu Sep 23 09:40:59 2021 +0200 Remove dominator check in fold_using_range::range_of_phi. Revert the following patch, as it was an artifact of diagnostic code being run with improper IL. commit 64b80b8819f9ea74712625bceb0ec4388e25f67d Author: Aldy Hernandez Date: Tue Sep 21 08:28:28 2021 +0200 Do not query SCEV in range_of_phi unless dominators are available. SCEV won't work without dominators and we can get called without dominators from debug_ranger. gcc/ChangeLog: * gimple-range-fold.cc (fold_using_range::range_of_phi): Remove dominator check. diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 1da1befa9a2..35324fd72c2 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -826,9 +826,7 @@ fold_using_range::range_of_phi (irange &r, gphi *phi, fur_source &src) } // If SCEV is available, query if this PHI has any knonwn values. - if (dom_info_available_p (CDI_DOMINATORS) - && scev_initialized_p () - && !POINTER_TYPE_P (TREE_TYPE (phi_def))) + if (scev_initialized_p () && !POINTER_TYPE_P (TREE_TYPE (phi_def))) { value_range loop_range; class loop *l = loop_containing_stmt (phi); --------------6902012184F63193E842EF1B--