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 285393858D20 for ; Mon, 15 May 2023 17:33:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 285393858D20 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=1684172029; 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=Hc3XILPgO5J11kbm55yL6XKkxsZl/uyuO1m15DR+7KI=; b=PDrmJbq5JrkZ0WLd1l4XF+tuGQd2I08hFuqZDHuQUJKvEZ92qkos5E8DoMFCwb36MjgQf+ /y31RWBuDbkm/GMF7VkCyujrRwyd+UvWEk6+ddvbJQf/Z/BnJmWEeCr2vOjp4qXm8UHq/v mJc+JDQLGBPYp5Y7ePdXzG0IHLehME4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-bF60UlzoN9KV14miUrKbpg-1; Mon, 15 May 2023 13:33:48 -0400 X-MC-Unique: bF60UlzoN9KV14miUrKbpg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f33f8ffa95so48881385e9.3 for ; Mon, 15 May 2023 10:33:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684172027; x=1686764027; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Hc3XILPgO5J11kbm55yL6XKkxsZl/uyuO1m15DR+7KI=; b=PEdVp+NoTmFVu7P3sdy9vqAoGdE+y+Bkz6esybKyszvjjUv8TzDK70oNtkzlzk6RXY 16j8R7j+OaNZf9kr8pWd5fvk8su3QlWtpUf0EmlfNSFL82C0r0AALWSOtoGw/HSZDhAA By26WN4s2v1PCVDd3/r7ldZTOAIS2TSeWMXwjMR1AOgdzpWZ8b5CQWoBKlRq3inUYM41 IQxXEgqKy/lT+ryIWGbkP2SzTeo7WKbSbyOxmcZ++2It51Y23WnZc2Pjf3eGXYvjhbfp Lyw16GoI7hGxlb7VO39kDOklH8ca9JY6Mz5ltDotSTkJz5TE6Y30aU7BbwDg1oV1Ez2W zrpQ== X-Gm-Message-State: AC+VfDySHKSOoxubaE7YKVRHZlRbD1M+MX9Fr3DmrLjJWNenlEyaAn6S Hwb50DcJ4wWcP8ZVCEvmsooP6n/ERmohBfP7UE0eWuMkt48NOEO2P+6421U8rGOoM8UwFyKSCDb YOxh4vPrGZdeHtSSekA== X-Received: by 2002:a1c:cc19:0:b0:3f5:bc8:e395 with SMTP id h25-20020a1ccc19000000b003f50bc8e395mr2292211wmb.11.1684172027508; Mon, 15 May 2023 10:33:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sJRoKCXc6DAjmTGndOHy0VEFNvWgp9/nxK4g0rLtKgaTLldPQO9L6S0TNmYc3AXx/UO/cOA== X-Received: by 2002:a1c:cc19:0:b0:3f5:bc8:e395 with SMTP id h25-20020a1ccc19000000b003f50bc8e395mr2292200wmb.11.1684172027167; Mon, 15 May 2023 10:33:47 -0700 (PDT) Received: from [192.168.1.201] ([139.47.42.170]) by smtp.gmail.com with ESMTPSA id g25-20020a7bc4d9000000b003f42d2f4531sm30726wmk.48.2023.05.15.10.33.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 May 2023 10:33:46 -0700 (PDT) Message-ID: <7057f6da-13ef-00df-8ed2-7ef794441fd7@redhat.com> Date: Mon, 15 May 2023 19:33:45 +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.9 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? > >> + 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?" Oh, I see what you mean. Take for instance this bit in ipa-cp: if (!irange::supports_p (dst_type) || !irange::supports_p (src_type)) return false; range_op_handler handler (operation, dst_type); return (handler && handler.fold_range (*dst_vr, dst_type, *src_vr, value_range (dst_type)) && !dst_vr->varying_p () && !dst_vr->undefined_p ()); range_op_handler::fold_range() takes a type agnostic vrange (from which irange inherits). If you pass it an irange, but the type is say a float, you'll get an ICE downstream. Ranger itself is type agnostic and takes a vrange almost everywhere. It's up to the user to make sure the the range type and the type of the operation matches. Eventually we should convert all those value_range arguments in IPA to vrange and have it work in a type agnostic manner. I have patches for this, but I still have to flush out all this preliminary stuff :). Aldy