From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E09723861928 for ; Tue, 6 Oct 2020 12:09:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E09723861928 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 98A81AF28; Tue, 6 Oct 2020 12:09:26 +0000 (UTC) Subject: Re: [PATCH] Add if-chain to switch conversion pass. To: Andrew MacLeod , Richard Biener Cc: David Malcolm , Jakub Jelinek , GCC Patches , Jan Hubicka , Aldy Hernandez References: <2c3db526-cac6-4eeb-4afb-12024f8d5af2@suse.cz> <20191104144851.GJ4650@tucnak> <6169f91a-4884-55f5-c76f-ea1dae11d996@suse.cz> <35eb0279-77d8-36f8-3ab7-afb9ae97fdb3@suse.cz> <42c91f11-c1a6-3ae4-08da-0a0b77f63b80@suse.cz> <72541e13d26f92577637b8f0e23d82435f35ddea.camel@redhat.com> <5bc2f096-ccb5-3e95-2145-4df39768f29c@suse.cz> <996e8d4d-05cc-25f2-cee7-36ba92f45312@redhat.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <98e3a2e4-6ee2-8a5d-6fce-b5e38a258592@suse.cz> Date: Tue, 6 Oct 2020 14:09:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <996e8d4d-05cc-25f2-cee7-36ba92f45312@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 12:09:29 -0000 On 10/2/20 4:19 PM, Andrew MacLeod wrote: > On 10/2/20 9:26 AM, Martin Liška wrote: >>> Yes, you simply get all sorts of conditions that hold when a condition is >>> true, not just those based on the SSA name you put in.  But it occured >>> to me that the use-case is somewhat different - for switch-conversion >>> you want to know whether the test _exactly_ matches a range test, >>> the VRP worker will not tell you that.  For example if you had >>> if (x &&  a > 3 && a < 7) then it will give you 'a in [4, 6]' and it might >>> not give you 'x in [1, 1]' (for example if x is float).  But that's required >>> for correctness. >> >> Hello. >> >> Adding Ranger guys. Is it something that can be handled by the upcoming changes in VRP? > > Presumably. It depends on exactly how the code lays out.  We dont process floats, so we wont know anything about the float (at least this release :-).  We will sort through complex logicals and tell you what we do know, so if x is integral > > >    if (x &&  a > 3 && a < 7) > > will give you, on the final true edge: > > x_5(D)  int [-INF, -1][1, +INF] > a_6(D)  int [4, 6] > > > IF x is a float, then we wont give you anything for x obviously, but on the eventual true edge we'd still give you > a_6(D)  int [4, 6] Which is an acceptable limitation for me. However, I can't convince ranger to give me a proper ranges for. I'm using the following code snippet: outgoing_range query; edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->succs) { int_range_max range; if (query.edge_range_p (range, e)) { if (dump_file) { fprintf (dump_file, "%d->%d: ", e->src->index, e->dest->index); range.dump(dump_file); fprintf (dump_file, "\n"); } } } if (9 <= index && index <= 123) return 123; : index.0_1 = (unsigned int) index_5(D); _2 = index.0_1 + 4294967287; if (_2 <= 114) goto ; [INV] else goto ; [INV] I get: 2->3: _Bool [1, 1] 2->4: _Bool [0, 0] Can I get to index_5 [9, 123] ? Thanks, Martin > > > Andrew > > >