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 D8F303858402 for ; Tue, 21 Sep 2021 17:16:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D8F303858402 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-376-1ahq-2HcP6Ky2GDLFEZEyQ-1; Tue, 21 Sep 2021 13:16:18 -0400 X-MC-Unique: 1ahq-2HcP6Ky2GDLFEZEyQ-1 Received: by mail-wr1-f70.google.com with SMTP id x2-20020a5d54c2000000b0015dfd2b4e34so9411445wrv.6 for ; Tue, 21 Sep 2021 10:16:18 -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 :content-transfer-encoding; bh=RlIKJhxBtJye142MAiO4QDrWWi02OEKVDr3rUaP3ayk=; b=6WpoQSfT/OwF4TBuleFk7IXjDS5o50ek4n111tzg1VXg30ZkhmJLfzBEMNZkagBCxq 3qYu/2ptVH4CngXQ6oueoxmAKDcNcepnKcOFGMyNP07QXV5Bj8GJTrp3xvt7e5Slf34Q T37jOZeDu29Dd65z4j8XzJuYNFPaaMc3WQi/OiIZcSb0I9/tP+hesYHKItbvXAArvQQM 3/SXspcTeKRW/Lxprq6PJYclI1hte99tLb15bY7FU2AOeFChCi9L+HwDTauCKKq+OLMC yLnGlXKbmOPtho88yLU/Knn21JxuMsMA7sRnMysHFKhv1j2Ljw4kkOAx9MC29NHSXqhx cRtA== X-Gm-Message-State: AOAM5313qgeJYnvur3EtxzOpNKB+zu00zh4ggnCMHoPsTq55/ZF0b+xo upKvt492l2/pPI3WT9EfqI5pUjxuqldkvg5F/4AaA3vrbZXryn0hchRzl8UOIje61grQK4IrjQU td9DWbppFHiflBh6sTg== X-Received: by 2002:a5d:56c4:: with SMTP id m4mr36988289wrw.225.1632244577078; Tue, 21 Sep 2021 10:16:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv5bn84sPWoW3lYcmf9DSGrYiYjO4IWacdZXCLfNXlUrgO76onnGTcBRw6s6n78mQgaseztg== X-Received: by 2002:a5d:56c4:: with SMTP id m4mr36988259wrw.225.1632244576807; Tue, 21 Sep 2021 10:16:16 -0700 (PDT) Received: from abulafia.quesejoda.com ([139.47.33.227]) by smtp.gmail.com with ESMTPSA id c8sm13115397wru.30.2021.09.21.10.16.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Sep 2021 10:16:15 -0700 (PDT) Subject: Re: [PATCH 2/7] Do not query SCEV in range_of_phi unless dominators are available. To: Andrew MacLeod Cc: GCC patches , Jeff Law References: <20210921165350.414593-1-aldyh@redhat.com> <20210921165350.414593-3-aldyh@redhat.com> From: Aldy Hernandez Message-ID: <5b599db2-3c8b-e75e-786b-0ce1d582cbd7@redhat.com> Date: Tue, 21 Sep 2021 19:16:14 +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: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, BODY_8BITS, 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: Tue, 21 Sep 2021 17:16:24 -0000 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::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; > } > >