From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 26B813858D39 for ; Wed, 22 Sep 2021 08:05:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 26B813858D39 Received: by mail-ed1-x530.google.com with SMTP id v22so6528044edd.11 for ; Wed, 22 Sep 2021 01:05:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gT6HDJkmT2AMGcCb68fyA9lLgsu/YDv2oCdMX5tUQQY=; b=tLj2EPT+j5OSzk7uY/6qbsfHycn/p0r0gCx/LrjuK9BWFCwxQieIz7LYSc0aJ232ak MDtc7u1RNiXWF7cCD/OjbnyznngfvcxhaFdS4FHuvMZOIVMH6GEFIbjxcToJ5EVfbGYh MBhqxVaFC2aX9PiYUDwG265C2NtIA5HqDqhWSY0DzDE8DTYec84upbg24eiE+qaKCX2q doyyQ7cVXdPamkq99oujqhMg8T6qldF+O5dwpfUA/oAl5IYxU+Gd2RJ5DUdGb/4dwUgV G9AumyE0Oh/ZD5De9q6Dq2gCHsCx7VZwJ5d/2yVcpaY94gPN4geRZPgvj//LxQ5Psnha 26Ig== X-Gm-Message-State: AOAM532+vpcpD+e3vHJdDeVDxUBNS79CTi2VAoYaDdfjd5aiv9TSmPL2 caSiLZNNixtCCoavLNHSPXSt162wtNDNrLmjBBw= X-Google-Smtp-Source: ABdhPJx7GFVA7VBTsO7cx3+nN4f5XOkkenciR27CWLhddwKV/w/G3qWKjrfceuEbvqG0vHIq2r2VbyGenaZB/NOvPgg= X-Received: by 2002:a17:906:584:: with SMTP id 4mr39463007ejn.56.1632297951070; Wed, 22 Sep 2021 01:05:51 -0700 (PDT) MIME-Version: 1.0 References: <20210921165350.414593-1-aldyh@redhat.com> <20210921165350.414593-3-aldyh@redhat.com> <5b599db2-3c8b-e75e-786b-0ce1d582cbd7@redhat.com> In-Reply-To: <5b599db2-3c8b-e75e-786b-0ce1d582cbd7@redhat.com> From: Richard Biener Date: Wed, 22 Sep 2021 10:05:40 +0200 Message-ID: Subject: Re: [PATCH 2/7] Do not query SCEV in range_of_phi unless dominators are available. To: Aldy Hernandez Cc: Andrew MacLeod , GCC patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Wed, 22 Sep 2021 08:05:56 -0000 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()? > Aldy > > > > > > > void > > scev_initialize (void) > > { > > gcc_assert (! scev_initialized_p ()); > > > > scalar_evolution_info = hash_table::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; > > } > > > > >