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 03CB238582BF for ; Wed, 12 Oct 2022 16:12:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03CB238582BF 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=1665591170; 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=++LCApC0+nT65+2yoN9DbiryodvaUOa2oB1RDMj32+4=; b=Lt527O7Rz8jiHCRU+fqOALITU+t37S3+cjGmWT7H5vntzQ8oPmg/oYT1gGSU3ZVU7hlWWd Lxx2a/4hOvqF/7miTXn25iYXPd0zXakhUFREmCOIciJ1or2/nOurHl1GpelMeX7rFSNjy0 UCe3dM77fXFy0t91kpVqe4i4HfeazlY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-508-0WaEp7fJNmimCegr3WVt7g-1; Wed, 12 Oct 2022 12:12:41 -0400 X-MC-Unique: 0WaEp7fJNmimCegr3WVt7g-1 Received: by mail-qt1-f199.google.com with SMTP id v9-20020a05622a188900b0035cc030ca25so11458142qtc.1 for ; Wed, 12 Oct 2022 09:12:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=++LCApC0+nT65+2yoN9DbiryodvaUOa2oB1RDMj32+4=; b=736QugU4YRHIOI9UfQXxE1sPPrC1ITMbyQE5tqBqFo28u8rIVbZ1TxxgoPF+sAuSIy sCwwUFSC8zvGhWgIu7q10PZBTP+QWkjJzfTJHEnDl87avy4fM5Qxd/QcSIbvNwWOsO4M +HPN8IePrMREUErBK0qlW/uIZApI6pIZWldmiJonJquB9rtMjbcontdABaHke+UBzTok CZYV/jjjz9turhkLzdM+6NcAVA8R7/SSbLeJkMR6lj1EUhHQIg/8HD6qd018Pdx8Np+m kWXPlWTCIg2enpZDcVdfTY4FSsWZZkH/OzZHLdL0pUjonqxZIdx8w9dl2+er1t1f1Mx4 9LHw== X-Gm-Message-State: ACrzQf3OksuS4K5XzgeHWY3gcm7wWN+3BK4vSFJzz/qiY6GYStZsZwvn pQEeTSNf1HlXR5t0BhBn+5ZGYjqerBglJhuz8Yn9P4ZghSjtKuRiMaUDkSm2MB/1hqKz/k5oQ97 BXh321RgBoUEPFt+b/g== X-Received: by 2002:ac8:7d4c:0:b0:399:b8eb:749e with SMTP id h12-20020ac87d4c000000b00399b8eb749emr13641835qtb.446.1665591161413; Wed, 12 Oct 2022 09:12:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HEPisIk605RDgZSnWG1IYWVluT3YP3lqUfJODPGfhSfN4sI3yIJiV3VYb+rkKmBiQErpW0A== X-Received: by 2002:ac8:7d4c:0:b0:399:b8eb:749e with SMTP id h12-20020ac87d4c000000b00399b8eb749emr13641814qtb.446.1665591161180; Wed, 12 Oct 2022 09:12:41 -0700 (PDT) Received: from ?IPV6:2607:fea8:a263:f600::50d4? ([2607:fea8:a263:f600::50d4]) by smtp.gmail.com with ESMTPSA id u10-20020a05620a430a00b006e702033b15sm15832120qko.66.2022.10.12.09.12.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Oct 2022 09:12:40 -0700 (PDT) Message-ID: <94879a41-16b5-6ec4-51ab-4d931b608147@redhat.com> Date: Wed, 12 Oct 2022 12:12:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] middle-end IFN_ASSUME support [PR106654] To: Jakub Jelinek Cc: Richard Biener , Jan Hubicka , Aldy Hernandez , gcc-patches@gcc.gnu.org References: <244e087a-8680-9c21-0774-c7b6621e2eda@redhat.com> <144534bb-c25e-5303-47e5-cf56beb98261@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=-5.2 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,SPF_HELO_NONE,SPF_NONE,TXREP 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 10/12/22 10:39, Jakub Jelinek wrote: > On Wed, Oct 12, 2022 at 10:31:00AM -0400, Andrew MacLeod wrote: >> I presume you are looking to get this working for this release, making the >> priority high? :-) > Yes. So that we can claim we actually support C++23 Portable Assumptions > and OpenMP assume directive's hold clauses for something non-trivial so > people won't be afraid to actually use it. > Of course, first the posted patch needs to be reviewed and only once it gets > in, the ranger/GORI part can follow. As the latter is only an optimization, > it can be done incrementally. I will start poking at something to find ranges for parameters from the return backwards. >> Intersection I believe...?  I think the value from the assume's should add >> restrictions to the range.. > Sure, sorry. > >> I figured as much, I was just wondering if there might be some way to >> "simplify" certain things by processing it and turning each parameter query >> into a smaller function returning the range we determined from the main >> one...   but perhaps that is more complicated. > We don't really know what the condition is, it can be pretty arbitrary > expression (well, e.g. for C++ conditional expression, so say > [[assume (var = foo ())]]; > is not valid but > [[assume ((var = foo ()))]]; > is. And with GNU statement expressions it can do a lot of stuff and until > we e.g. inline into it and optimize it a little, we don't really know what > it will be like. > > No, I just meant that once we finally process the complicated function, and decide the final range we are storing is for x_1 is say [20,30], we could replace the assume call site with something like   int assume03_x (x) { if (x>= 20 || x <= 30) return x; gcc_unreachable(); } then at call sites:    x_5 = assume03_x(x_3); For that matter, once all the assume functions have been processed, we could textually replace the assume call with an expression which represents the determined range...  Kind of our own mini inlining?  Maybe thats even better than adding any kind of support in fold_using_range..   just let things naturally fall into place? .ASSUME_blah ( , , x_4); where if x is determined to be [20, 30][50,60] could be textually "expanded" in the IL with   if (x<20 || x>60 || (x>30 && x < 50)) gcc_unreachcable(); for each of the parameters?   If we processed this like early inlining, we could maybe expose the entire thing to optimization that way? Andrew