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 ESMTPS id 6E6A53858C54 for ; Thu, 11 May 2023 09:58:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E6A53858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683799101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BS9cjNWaUsMZykJEMxL3fTcbT7w/b8ckKxiZZagZ3Z0=; b=dDQUVW0sxhQv2UKmIgjqh7n0f5xVoxlFzxx/Hk6x+RwZ9Z6m1C3SH/E5gH+r1f5w88oalF r8UA1a1TWDh9zXuut0iELPPlevEk1URMKfXorDARNNLZ51NwUsn8ki4co0IRBDOJVFoMv/ 4R/plR7R0DZo8h+oytLtXqWTQ387qzM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-Csfqo4exM3eVAM77dFCBjA-1; Thu, 11 May 2023 05:58:19 -0400 X-MC-Unique: Csfqo4exM3eVAM77dFCBjA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3076fc5c278so4945115f8f.3 for ; Thu, 11 May 2023 02:58:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683799099; x=1686391099; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BS9cjNWaUsMZykJEMxL3fTcbT7w/b8ckKxiZZagZ3Z0=; b=LCG/IWqukxcEP7xdlkq0ffO9L8rtrYJJWJDfL4CQO4ItHYbIn4xdG+pKSa3pK0OqdB tWnEann417xuc3EI3Ju6MW8Oqp8UvaaAP037TICGlQD7LMZiGM4XBWlUekiVyfh7kQD7 TRIHQZodgSOzekR4V+Amppfpu1F/6i28sb+AHgHpRrQphFGaN2oabdlU4jsXXikF+X23 wXAxCEIKcBDTEg7wIbRQsVYlsv8VFBLjloJ9Jf/2G5VS0BpSF5DeRV1USswoqI64vKDC 2mbBGxrIAMawG2vE8n0thHUfU/KylIkB/kYt1A1FUJjyiFXVeOHIacn1iCMT8NL9YEA8 zZpg== X-Gm-Message-State: AC+VfDzjGmoQXzaBvYmkVMtXAz4EISx2kB/5EDwLqqtkvv8yrQD5B2VA ubIE0kjdWe7mOmh8W7Zic0/V7Min30gy379/01Upavp9Fh0fIkn1pjDdN0ntp4iEDL0UBXe8E67 9gRi1m++n/PnoDdYJvQ== X-Received: by 2002:a5d:55cf:0:b0:304:b967:956f with SMTP id i15-20020a5d55cf000000b00304b967956fmr15714534wrw.8.1683799098800; Thu, 11 May 2023 02:58:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WxjMHsF55e36ym9cWpeSguLQTlGBaHtm+LwkwP+oLg+PnltHQQEqi8vu+QIeT9lG7xsSyNw== X-Received: by 2002:a5d:55cf:0:b0:304:b967:956f with SMTP id i15-20020a5d55cf000000b00304b967956fmr15714516wrw.8.1683799098468; Thu, 11 May 2023 02:58:18 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id t17-20020adfeb91000000b00307bbbecd29sm3926178wrn.62.2023.05.11.02.58.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 May 2023 02:58:18 -0700 (PDT) Message-ID: <5ec033e7-60a0-53c0-f44f-2a435646b2c5@redhat.com> Date: Thu, 11 May 2023 11:58:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr uses from ipa-*. To: Martin Jambor , GCC patches Cc: Andrew MacLeod References: <20230426083328.313566-1-aldyh@redhat.com> <20230426083328.313566-4-aldyh@redhat.com> From: Aldy Hernandez In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.1 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_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/5/23 17:10, Martin Jambor wrote: > Hello, > > On Wed, Apr 26 2023, Aldy Hernandez via Gcc-patches wrote: >> gcc/ChangeLog: >> >> * ipa-cp.cc (ipa_vr_operation_and_type_effects): Convert to ranger API. >> (ipa_value_range_from_jfunc): Same. >> (propagate_vr_across_jump_function): Same. >> * ipa-fnsummary.cc (evaluate_conditions_for_known_args): Same. >> * ipa-prop.cc (ipa_compute_jump_functions_for_edge): Same. >> * vr-values.cc (bounds_of_var_in_loop): Same. > > thanks for taking care of the value range uses in IPA. > >> --- >> gcc/ipa-cp.cc | 28 +++++++++++++++++++++------ >> gcc/ipa-fnsummary.cc | 45 ++++++++++++++++++++++++++++---------------- >> gcc/ipa-prop.cc | 5 ++--- >> gcc/vr-values.cc | 6 ++++-- >> 4 files changed, 57 insertions(+), 27 deletions(-) >> >> diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc >> index 65c49558b58..6788883c40b 100644 >> --- a/gcc/ipa-cp.cc >> +++ b/gcc/ipa-cp.cc >> @@ -128,6 +128,7 @@ along with GCC; see the file COPYING3. If not see >> #include "attribs.h" >> #include "dbgcnt.h" >> #include "symtab-clones.h" >> +#include "gimple-range.h" >> >> template class ipcp_value; >> >> @@ -1900,10 +1901,15 @@ ipa_vr_operation_and_type_effects (value_range *dst_vr, >> enum tree_code operation, >> tree dst_type, tree src_type) >> { >> - range_fold_unary_expr (dst_vr, operation, dst_type, src_vr, src_type); >> - if (dst_vr->varying_p () || dst_vr->undefined_p ()) >> + if (!irange::supports_p (dst_type) || !irange::supports_p (src_type)) >> return false; >> - return true; >> + >> + range_op_handler handler (operation, dst_type); > > Would it be possible to document the range_op_handler class somewhat? Sorry for the late response, but you're totally right. We're in dire need of documentation here. I had planned to work on comments and actual documentation much later this cycle, but I may need to bump that up in priority. > >> + return (handler >> + && handler.fold_range (*dst_vr, dst_type, >> + *src_vr, value_range (dst_type)) >> + && !dst_vr->varying_p () >> + && !dst_vr->undefined_p ()); > > It looks important but the class is not documented at all. Although the > use of fold_range is probably hopefully mostly clear from its uses in > this patch, the meaning of the return value of this method and what > other methods do is less obvious. > > For example, I am curious why (not in this patch, but in the code as it > is now in the repo), uses of fold_range seem to be always preceeded with > a check for supports_type_p, even though the type is then also fed into > fold_range itself. Does the return value of fold_range mean something > slightly different from "could not deduce anything?" Returning false from fold_range() is a shortcut for I don't know anything, which will be treated as VARYING upstream. The other methods also need documentation. The most important ones are documented in range-op.h: // This class is implemented for each kind of operator supported by // the range generator. It serves various purposes. particularly op1_range, and op2_range which can be confusing. But yes, we need to revisit this, as those comments are pretty out of date. Aldy