From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id A2BF23858C51 for ; Sun, 26 Jun 2022 18:49:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A2BF23858C51 Received: by mail-pl1-x636.google.com with SMTP id k7so6345600plg.7 for ; Sun, 26 Jun 2022 11:49:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=2yGM0/zSFzvsZL+7GMX8T9kBJ7AFIWsk5RB0s2sKVnQ=; b=WMq9G60xSrljkIVpnTEnHc/C6becRMqZGjiYbAyJ9ODt0RdU7xjbUFWPm9ze+xAkwC 2Hai+IryQ/rThbVgnGvqPt0wQhk1Ba2NSrKAThpdNWK/HAENLFegmPHAwIgC2MR8/Qq0 dAC/mYX7zzKQrUuPHRw+xogUwK8kH4azwSRAyH5kUxGQiIIZZeq9MkQxbCAWPZiEFrsq phCN2dQ25aLiDbzVeskvHemYLzJJXTouzSFOrHLRsHkjMGErfxD+j27cYinWEJoAkpaX X3IjEmdKFBTBtD3UrWdXu2aUCJuu9dOgNjdnmhuZtQw6mMV6VcVCQyDFDH3Y1B6fL1Y7 kOQw== X-Gm-Message-State: AJIora+jLD4kRepfTliIogfAfS3uj9fY6kUfDr9niyRS3pWOb4D5cQkr RL0Pk45zwLGgYJvHG8zp+ObQzF0pgms= X-Google-Smtp-Source: AGRyM1vvUwYVi7tKKd/D9pXJLZ5M/vxk2fXuU4ppbo+rm/Y8/DWhx+aQWVnBAFOgmGzrvKp+PXhm+g== X-Received: by 2002:a17:90a:4e4b:b0:1ec:d1e2:3cd0 with SMTP id t11-20020a17090a4e4b00b001ecd1e23cd0mr11269392pjl.244.1656269381153; Sun, 26 Jun 2022 11:49:41 -0700 (PDT) Received: from [192.168.43.42] ([172.58.38.202]) by smtp.gmail.com with ESMTPSA id f11-20020a170902f38b00b0016a1e2d1491sm5528819ple.59.2022.06.26.11.49.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jun 2022 11:49:40 -0700 (PDT) Message-ID: <1e182beb-15d3-71a6-f093-cbbdd9f91b44@gmail.com> Date: Sun, 26 Jun 2022 12:49:39 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] [PR105455] predict: Check for no REG_BR_PROB in uninitialized case Content-Language: en-US To: gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sun, 26 Jun 2022 18:49:46 -0000 On 5/11/2022 7:48 PM, Alexandre Oliva via Gcc-patches wrote: > There is an assumption in force_edge_cold that, if any edge out of the > same src block has uninitialized probability, then a conditional > branch out of src won't have REG_BR_PROB set. > > This assumption is supposed to hold, but buggy gimple passes may turn > unconditional edges into conditional ones, adding edges with > uninitialized probability out of blocks that retain originally > unconditional edges with precise always probability. Expand may then > copy the formerly-unconditional edge's probability to REG_BR_PROB, and > if that edge ends up forced cold, the probability in the edge will be > modified without adjusting the note, and rtl_verify_edges complains > about that. > > This patch adds checking that REG_BR_PROB is absent to the path taken > by force_cold_edge for uninitialized probabilities, so that the > problem is caught earlier and fixed sooner. > > I'm not sure it buys us much, but... Regstrapped on x86_64-linux-gnu. > Ok to install? > > > for gcc/ChangeLog > > * predict.cc (force_edge_cold): Check for no REG_BR_PROB in > the uninitialized probability case. Should that be a runtime test (flag_checking) rather than a compile/configure time test (#if CHECKING_P)?  I think we generally perfer the former these days.   If you strongly think it should be a #if CHECKING_P, that's fine.  I just want you to ponder if the runtime test is more appropriate or not and change if you think it's warranted. OK either way. Jeff