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.129.124]) by sourceware.org (Postfix) with ESMTPS id 00A2B3858D3C for ; Wed, 19 Oct 2022 17:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 00A2B3858D3C 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=1666201350; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBI2T/uVT0sgg2DT5V2OGXSDDo8NqYRj36NQkMztOGs=; b=CdEMe4tai7IK/OShRfTCXMZF3M5cfJ4VnPmxkHjP5CV9E7fz/xXvXyz+bog0/p0V29b9Nc X2CHo2oJfzVOASN5aeIRKiJ09XfRJsrmjQCBAtWTA1XQjS6k2UR/8wQA/tz7RrhbPzjn2X pei8gz+MQM4uOaFZUOGxLD9XWGYCrcA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-187-CjP-o3N6N9u3B7Uun1-ZFg-1; Wed, 19 Oct 2022 13:42:29 -0400 X-MC-Unique: CjP-o3N6N9u3B7Uun1-ZFg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2BC087A9ED; Wed, 19 Oct 2022 17:42:28 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1412410B235; Wed, 19 Oct 2022 17:42:28 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 29JHfuKV3963993 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 19:42:11 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29JHfcIO3963991; Wed, 19 Oct 2022 19:41:38 +0200 Date: Wed, 19 Oct 2022 19:41:38 +0200 From: Jakub Jelinek To: Andrew MacLeod , Jan Hubicka , Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] middle-end, v4: IFN_ASSUME support [PR106654] Message-ID: Reply-To: Jakub Jelinek References: <479fa663-fb3e-a90d-ae7a-0fdd5acbfa00@redhat.com> <16da3b46-f061-076a-19b5-c482f45477b3@redhat.com> <70311a20-1a94-21a1-e897-37289c9e0f0c@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=WINDOWS-1252 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Wed, Oct 19, 2022 at 07:39:05PM +0200, Jakub Jelinek via Gcc-patches wrote: > On Wed, Oct 19, 2022 at 12:55:12PM -0400, Andrew MacLeod via Gcc-patches wrote: > > > Not sure I understand this part. op is whatever we pass as the ith > > > argument to IFN_ASSUME. I'd expect that at this point one needs to > > > remap that to the (i-1)th PARM_DECL of assume_id (so e.g. when you > > > have the above loop you could as well start with DECL_ARGUMENTS and move > > > that to DECL_CHAIN at the end of every iteration. And then > > > query ssa_default_def (DECL_STRUCT_FUNCTION (assume_id), parm) > > > in each case and get global range of what that returns. > > > > OK, this is the bit of code I dont know how to write :-) > > > > yes, op is the name of the value within this current function, and yes, that > > needs to be mapped to the argument decl in the assume function.   Then we > > need to query what range was given to that name during the assume pass.  > > when that is returned, the add_range (op, range) will inject it as a side > > effect. > > > > Can you write that loop? > > I meant something like (untested code): > && gimple_call_internal_fn (s) == IFN_ASSUME) > { > tree assume_id = gimple_call_arg (s, 0); > - for (unsigned i = 1; i < gimple_call_num_args (s); i++) > + tree parm = DECL_ARGUMENTS (assume_id); > + struct function *fun = DECL_STRUCT_FUNCTION (assume_id); > + for (unsigned i = 1; > + i < gimple_call_num_args (s) && parm; > + i++, parm = DECL_CHAIN (parm)) > { > tree op = gimple_call_arg (s, i); > tree type = TREE_TYPE (op); > + tree arg = ssa_default_def (fun, parm); > + if (arg == NULL_TREE) > + continue; > if (gimple_range_ssa_p (op) && Value_Range::supports_type_p (type)) > { > Value_Range assume_range (type); > and querying SSA_NAME_RANGE_INFO of arg rather than op. Oops, the tree arg = ... stuff would need to be moved into the if (gimple_range...) body, it won't work for aggregate PARM_DECLs etc., only PARM_DECLs with is_gimple_reg_type (TREE_TYPE (arg)). Jakub