Message ID | 20210921165350.414593-3-aldyh@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E5203858439 for <patchwork@sourceware.org>; Tue, 21 Sep 2021 17:00:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E5203858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632243630; bh=32R3fQZZUdvg1eVtYP8Y7BIGezuU4+WLMqmYc4KtKnA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=POUZ3B8qpIt4JmDeO8soT++Ahj8q0uVDZkje7ejyRJxGp/5syU/h4kdj3M6vGZiAX PqAyg9s+463qL6BZ7QuG3Fmn5FvWvTLL5MazapeUflpI0PDty0e9X0uaTRUDjVWAqW 4a39Iw0EOkb7GZfMQ3CgFFruFg3A+c/Qy3r/j69I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 D678B3858005 for <gcc-patches@gcc.gnu.org>; Tue, 21 Sep 2021 16:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D678B3858005 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-cNCLg7_KMRemNv1ixhX5nA-1; Tue, 21 Sep 2021 12:54:09 -0400 X-MC-Unique: cNCLg7_KMRemNv1ixhX5nA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 365FF1018F62; Tue, 21 Sep 2021 16:54:08 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.248]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0B3E1024873; Tue, 21 Sep 2021 16:54:07 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.16.1/8.15.2) with ESMTPS id 18LGs5m0414667 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 21 Sep 2021 18:54:05 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 18LGs5iY414666; Tue, 21 Sep 2021 18:54:05 +0200 To: Andrew MacLeod <amacleod@redhat.com> Subject: [PATCH 2/7] Do not query SCEV in range_of_phi unless dominators are available. Date: Tue, 21 Sep 2021 18:53:45 +0200 Message-Id: <20210921165350.414593-3-aldyh@redhat.com> In-Reply-To: <20210921165350.414593-1-aldyh@redhat.com> References: <20210921165350.414593-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Aldy Hernandez <aldyh@redhat.com> Cc: GCC patches <gcc-patches@gcc.gnu.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Add ability to resolve unknowns to path solver.
|
|
Commit Message
Aldy Hernandez
Sept. 21, 2021, 4:53 p.m. UTC
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(-)
Comments
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. void scev_initialize (void) { gcc_assert (! scev_initialized_p ()); scalar_evolution_info = hash_table<scev_info_hasher>::create_ggc (100); for (auto loop : loops_list (cfun, 0)) loop->nb_iterations = NULL_TREE; } /* Return true if SCEV is initialized. */ bool scev_initialized_p (void) { return scalar_evolution_info != NULL; }
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. Aldy > > > void > scev_initialize (void) > { > gcc_assert (! scev_initialized_p ()); > > scalar_evolution_info = hash_table<scev_info_hasher>::create_ggc (100); > > for (auto loop : loops_list (cfun, 0)) > loop->nb_iterations = NULL_TREE; > } > > /* Return true if SCEV is initialized. */ > > bool > scev_initialized_p (void) > { > return scalar_evolution_info != NULL; > } > >
On Tue, Sep 21, 2021 at 7:17 PM Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> 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()? > Aldy > > > > > > > void > > scev_initialize (void) > > { > > gcc_assert (! scev_initialized_p ()); > > > > scalar_evolution_info = hash_table<scev_info_hasher>::create_ggc (100); > > > > for (auto loop : loops_list (cfun, 0)) > > loop->nb_iterations = NULL_TREE; > > } > > > > /* Return true if SCEV is initialized. */ > > > > bool > > scev_initialized_p (void) > > { > > return scalar_evolution_info != NULL; > > } > > > > >
On 9/22/21 10:05 AM, Richard Biener wrote: > On Tue, Sep 21, 2021 at 7:17 PM Aldy Hernandez via Gcc-patches > <gcc-patches@gcc.gnu.org> 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
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);