From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id ACBC83858C62 for ; Mon, 28 Nov 2022 17:38:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ACBC83858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62e.google.com with SMTP id w23so10849039ply.12 for ; Mon, 28 Nov 2022 09:38:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iqUvlE376OY7IZEMFQn/HN68yB+yisZcdxmp5PX6t0Y=; b=QjhGydVxGAkT0++gVD+AqZaXaGKs3crnxSebJq8nQ+diaWHwJSjX5hElCfRBlcXtEH W64eipYFWp5c0/Fc7J7n/lPpuFykYkXe8+HjKJZb33zauGpBp8TS+egkQEEI/BYNcQSf CwoYxFRRaGRipOxFR7mhy9Wrmti3tNYvDz9ygecJRvRcxLx2uU7x3CGW2uezGnpMFEO8 kSnUjl1dc4Mun8l1Ae3eCtLxLEjQzIaB18B91c/mzOeQ9PaAiAVBVDbh063rBUxcQoDy CfYEB5n3n/1wxad6qP1Iqnku3hKdKwr3U0cdk8gagvLdGBeHu67wKjV0YKbiuzBPm41k GDbQ== 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: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=iqUvlE376OY7IZEMFQn/HN68yB+yisZcdxmp5PX6t0Y=; b=Dng3D6kCXU/MyQWPpjbGzbxTo3toYeJLp7l/SUh3jw1Ze+KdV++8erTHttKYlzPRYV ygaAgkd5y4a0adAvbSiJ2CtaqggxsnWcReQ6ohR6omsH/WtdL6CSatEXI+2txD3GO+pD vZj4a/uT3NC407X8SlWnfe/sRmcn8K3n6qvlacrqH+lPQ2BPz5xaaLV+rRonphYCp2kg o0xyWlYIt/ovuN/u3o9EjKZAo9eEstdFfhpKVD8ufK5h3Ubuh3PwQ51JihfMyqMAQhb6 cet4/Ob4CgjVV93Glw0pXI8OhfDamYhi3sOxLknTEFwNDU0FPzm/0nSdRjUjYTYzWd1y ecAw== X-Gm-Message-State: ANoB5pnmdH9v/q/QFu+bFwzEbXAaRBVZax4JJQVuPmCrZywMUzt6l1ZX onwsTVnxaj3aJBJhV+6Nz9NospULXyk= X-Google-Smtp-Source: AA0mqf4gab0/HTXK94MZnM7E1QA9y+QysfklH+o5S5/7OVtClIKvyT22+dfamFcGaZgRdh6TvDNqag== X-Received: by 2002:a17:90a:77cc:b0:219:1747:f19c with SMTP id e12-20020a17090a77cc00b002191747f19cmr14507850pjs.222.1669657123602; Mon, 28 Nov 2022 09:38:43 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id u9-20020a17090a2b8900b00218e8a0d7f0sm9567444pjd.22.2022.11.28.09.38.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Nov 2022 09:38:43 -0800 (PST) Message-ID: <1a66c1f0-8525-f86e-bd8e-7c706a1135b4@gmail.com> Date: Mon, 28 Nov 2022 10:38:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] Improve profile handling in switch lowering. Content-Language: en-US To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , gcc-patches@gcc.gnu.org References: <596c4483-864c-1d03-955c-69906171f037@suse.cz> From: Jeff Law In-Reply-To: <596c4483-864c-1d03-955c-69906171f037@suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 1/26/22 04:11, Martin Liška wrote: > Hello. > > Right now, switch lowering does not update basic_block::count values > so that they are uninitiliazed. Moreover, I've updated probability scaling > when a more complex expansion happens. There are still some situations > where > the profile is a bit imprecise, but the patch improves rapidly the > current situation. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > >     PR tree-optimization/101301 >     PR tree-optimization/103680 > > gcc/ChangeLog: > >     * tree-switch-conversion.cc (bit_test_cluster::emit): >     Handle correctly remaining probability. >     (switch_decision_tree::try_switch_expansion): Fix BB's count >     where a cluster expansion happens. >     (switch_decision_tree::emit_cmp_and_jump_insns): Fill up also >     BB count. >     (switch_decision_tree::do_jump_if_equal): Likewise. >     (switch_decision_tree::emit_case_nodes): Handle special case >     for BT expansion which can also fallback to a default BB. >     * tree-switch-conversion.h (cluster::cluster): Add >     m_default_prob probability. Funny you just ping'd this patch. I've held it in my queue for months as I didn't see it get installed. As far as I'm concerned, you know the switch conversion bits better than anyone. If you think the patch significantly improves the profile handling for switch conversion, then I'd say go for it. Particularly since it seems to fix at least two known bugs. Keff