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 447703858C52 for ; Fri, 14 Jul 2023 21:00:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 447703858C52 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=1689368433; 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=gVgXxxoMoMGevQXU1gMPqsHEs+L3yMESp9BmcLJVtNg=; b=jKdnS9Y/vFVxqqdVDhT9Go52g2NlXtEkOyajFDCZQoi45JdKDAU+fbKdRygbaLjGIMQbjU j39xmd/w/4iEa6ykizkuIvitgt/AFenckxRiPHJfQv/nZUxdsPaaQDuchgnlQbjNRbQnBI WAlvIGJnfcXive0K2z4cMIOrfb4bKxQ= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-mUOLrmoFMFG-UXYZgYtw3g-1; Fri, 14 Jul 2023 17:00:32 -0400 X-MC-Unique: mUOLrmoFMFG-UXYZgYtw3g-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-635eeb952b8so23077466d6.3 for ; Fri, 14 Jul 2023 14:00:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689368432; x=1691960432; 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=gVgXxxoMoMGevQXU1gMPqsHEs+L3yMESp9BmcLJVtNg=; b=OlhyQ1cJfju7jYFLEk7FqjGlIuBlH3lsrwx664WvGx7UcrPigtq4t2XLCnon7OY0Zv 0Yu857YrsTRvomKWVEIkHgy6+B629wArNyOVgAPgh+sqeFAl3V1YV+FKnNmbla+HKDb1 SuKLPMfc4/JNnaSCubvsvgTyoj8DqDOMKcJ28lhxsVRQIRP00fyeu2cKsMSixhlqkOJ+ 2AfLnxgDGzNDqPCPhruX44/0xSkJv+Yor/KePO/CVh64q9BmpIiIS2FwX6EWLaULLPTC J07uS/HQLrlof+7yNwXpT96AQJx+xKstVu2Yc61YfK4vbuxbrhMXmaK0qOTvRET0KGV+ mUcw== X-Gm-Message-State: ABy/qLb/xzXd0aFAltLw9AqHQsoCTE2kYeCy2WwtMzPappbf8F/4PqAI mlsTnzAqcCNGoqgRmxWdwyEEEHNTdLi3K7z5fSA+4o8VAtTRnT/ziqIp2oJzXhYuOgy6/2LVF0q QXWx51XLuGmjTleKOZw== X-Received: by 2002:a0c:8e81:0:b0:635:ef7b:c74e with SMTP id x1-20020a0c8e81000000b00635ef7bc74emr4989144qvb.62.1689368432056; Fri, 14 Jul 2023 14:00:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUxZZOMhdn4n8y7BNHaqkkTdEZINyVHdkSuwDlOwtxsd8pWp0D1e3FXn8RpOosfpykqUqXQw== X-Received: by 2002:a0c:8e81:0:b0:635:ef7b:c74e with SMTP id x1-20020a0c8e81000000b00635ef7bc74emr4989121qvb.62.1689368431820; Fri, 14 Jul 2023 14:00:31 -0700 (PDT) Received: from ?IPV6:2605:8d80:6c2:636f:15fc:cf03:a37:37d5? ([2605:8d80:6c2:636f:15fc:cf03:a37:37d5]) by smtp.gmail.com with ESMTPSA id h5-20020a0cab05000000b0063631be090csm4304007qvb.125.2023.07.14.14.00.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jul 2023 14:00:31 -0700 (PDT) Message-ID: Date: Fri, 14 Jul 2023 17:00:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH V4] Optimize '(X - N * M) / N' to 'X / N - M' if valid To: Richard Biener , Aldy Hernandez Cc: Jiufu Guo , gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, richard.sandiford@arm.com, segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org, bergner@linux.ibm.com References: <20230711090413.3587421-1-guojiufu@linux.ibm.com> <430f2117-3848-d9e5-edab-607a58a460de@redhat.com> From: Andrew MacLeod 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: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 7/14/23 09:37, Richard Biener wrote: > On Fri, 14 Jul 2023, Aldy Hernandez wrote: > >> I don't know what you're trying to accomplish here, as I haven't been >> following the PR, but adding all these helper functions to the ranger header >> file seems wrong, especially since there's only one use of them. I see you're >> tweaking the irange API, adding helper functions to range-op (which is only >> for code dealing with implementing range operators for tree codes), etc etc. >> >> If you need these helper functions, I suggest you put them closer to their >> uses (i.e. wherever the match.pd support machinery goes). > Note I suggested the opposite beacuse I thought these kind of helpers > are closer to value-range support than to match.pd. probably vr-values.{cc.h} and  the simply_using_ranges paradigm would be the most sensible place to put these kinds of auxiliary routines? > > But I take away from your answer that there's nothing close in the > value-range machinery that answers the question whether A op B may > overflow? we dont track it in ranges themselves.   During calculation of a range we obviously know, but propagating that generally when we rarely care doesn't seem worthwhile.  The very first generation of irange 6 years ago had an overflow_p() flag, but it was removed as not being worth keeping.     easier to simply ask the question when it matters As the routines show, it pretty easy to figure out when the need arises so I think that should suffice.  At least for now, Should we decide we would like it in general, it wouldnt be hard to add to irange.  wi_fold() cuurently returns null, it could easily return a bool indicating if an overflow happened, and wi_fold_in_parts and fold_range would simply OR the results all together of the compoent wi_fold() calls.  It would require updating/audfiting  a number of range-op entries and adding an overflowed_p()  query to irange. Andrew