From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 358BD3857C40 for ; Wed, 1 Dec 2021 14:48:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 358BD3857C40 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 238F01FD5A; Wed, 1 Dec 2021 14:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1638370113; h=from:from:reply-to: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=j40UTwQezcaNDnJ2AqB2zzFwk2oCLEFCBnKCM3eMzvI=; b=ajJM/kinBKGmOu0qidfPkh/nZ6F7ZTo5iBx4/+YL7XMvGHdfWTtuJ/NMKXphDlZdlU43+K OJUCRCeLpN4QjPGIEPR+qsg2RoRvXxQlaLoddrZx8fqr46W8Mv/uwiomp2RbXXGqF21G8t PHN8XhttVxbujfQJ2IHUFQNtbCM7ZhY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1638370113; h=from:from:reply-to: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=j40UTwQezcaNDnJ2AqB2zzFwk2oCLEFCBnKCM3eMzvI=; b=BkrPXQFIErIi35UNVy+upB/7dgLBYsw3rK6VQTpXh5ujxdbsnW2NYoyjn+IBrETc8asaxx WYWMdOwePWFjrWAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 09229134CE; Wed, 1 Dec 2021 14:48:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id D/VMAUGLp2EUawAAMHmgww (envelope-from ); Wed, 01 Dec 2021 14:48:33 +0000 Message-ID: <33509887-dfa3-6bb0-6fbe-cec8873f651f@suse.cz> Date: Wed, 1 Dec 2021 15:48:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH] Loop unswitching: support gswitch statements. Content-Language: en-US To: Richard Biener Cc: GCC Patches , Andrew MacLeod References: <0db1d9e8-f097-e766-a9fa-1a98c47b8115@suse.cz> <3a07ef98-d05f-dc07-2e36-a2b4ffd52936@suse.cz> <7bcc368c-3f26-4503-aec1-a3d6378e33ec@suse.cz> <561a3ffd-8973-d771-418f-76c484085cc5@suse.cz> <20265d97-6350-c234-695d-bc18e2e617b4@suse.cz> <1169b649-e3e2-36c9-f964-0b0ecd2530fa@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 01 Dec 2021 14:48:35 -0000 On 12/1/21 15:34, Richard Biener wrote: > On Wed, Dec 1, 2021 at 3:25 PM Martin Liška wrote: >> >> On 12/1/21 15:19, Richard Biener wrote: >>> which is compute the range of 'lhs' on edge_true into predicate->true_range, >>> assign that same range to ->false_range and then invert it to get the >>> range on the false_edge. What I am saying is that for better precision >>> you should do >>> >>> ranger->range_on_edge (predicate->false_range, edge_false, lhs); >>> >>> rather than prematurely optimize this to the inversion of the true range >>> since yes, ranger is CFG sensitive and only the_last_ predicate on a >>> long CFG path is actually inverted. >>> >>> What am I missing? >> >> I might be misunderstood, but I think it's the problem defined here: >> https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584605.html >> >> where I used the ranger->range_on_edge on the false_edge. > > Ah, OK. But then even the true_edge range is possibly wrong, no? You are of course correct, I've just proved that in debugger :// > Consider > > for (;;) > { > if (a < 100) > if (a > 50) // unswitch on this > /* .. */ > if (a < 120) > /* ... */ > } > > then you record [51, 99] for true_range of the a > 50 predicate and thus > simplification will simplify the if (a < 120) check, no? Yep. > > You can only record the range from the (CFG independent) a > 50 check, > thus [51, +INF] but of course at simplification time you can also use > the CFG context at each simplification location. @Andrew: How can I easily get irange based just on a stmt? Something like fold_range with int_range_max as the 3rd argument? Thanks, Martin > > Richard. > >> Martin