Message ID | or1qdoculr.fsf_-_@lxoliva.fsfla.org |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp160606vqx; Sat, 21 Oct 2023 00:18:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSRwZ3E6z9LPEbgvnZ0AdYY9MgDTg4L1s07WrjuGgVKKvmZJGYYkQQoVF4J6hLGn8TCTyH X-Received: by 2002:a05:620a:847:b0:775:8ed7:887 with SMTP id u7-20020a05620a084700b007758ed70887mr3984795qku.26.1697872709174; Sat, 21 Oct 2023 00:18:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697872709; cv=pass; d=google.com; s=arc-20160816; b=KQBMzTUzPhi+wQWo1kkVwpFKCbibtbuGoJ0FNu1T7ohXGpJx/bpxDSV1TjbqpdX4Wz N7xbCAzFXT06pRLTTXBDPVsFTiE7FmHrj6S8sgw5u1HAFjeos/I5CCiGZ9QJEkeEMAcd Vkm6C+Eqju8oVBxrH6wfbyii7jin5SD4ISDzOKCvsjUYI5OSgiqx+MSbC4Mv/K1ubi4A 9+Axzq1dqFXP7afvOMA+2SZ1cr8LLHE14Wtxt+MULp+NYsOyEuJezteqOFcu9PMpjlc2 VZlhuDYaeNYOvvsLuMzTLcLfSGKgftwnXcI+4POjyYVzgY82PlttygrMGuU6FQrYMKhF 6LMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:in-reply-to:date:references:organization:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=+GqWmuV2KLrOPYw1453/vCYBKPaY6N5Alhts4RA+iRU=; fh=x984jQnJ112xSe6rV5yK+CjNGAqv6p4VeoDFvkYQNo0=; b=hzeXIQtLxreqQ3yA2mUTKrXtajjwPiKx2N7/CzPPS8hEzOuKa7o9jNRWePEYRyj995 82i3SmKsYc9n/vrqTxpoOwJSlw30qSkEcDO44vU6o+Ceeij0eJtiA54Ad2wJQrLzQOoJ ZMPhNGLOr2cDVDjfg3YDjNOmQmkRmBasosib5pYjl5a7P/ZIJsM7Dd8G5xms3zgVDQQf lHeg6hQSiTtYJ7d5y/AbOBMq/VjE3OKpB6a2Amj0k/FQ1TIjuaF3BuQpHFcWcf/Xf5O6 /tC+PXtwu0/k9CiW68egtwPbV+koSn5WLAucJX67iczmEZ+ITV2CkRbOJ+wrURC1g+sb 0otQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=f3Z4SlF1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id a7-20020a05620a16c700b00767dfe07ec4si2361152qkn.164.2023.10.21.00.18.29 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 00:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=f3Z4SlF1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2491385840A for <ouuuleilei@gmail.com>; Sat, 21 Oct 2023 07:18:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 8DCD83858D20 for <gcc-patches@gcc.gnu.org>; Sat, 21 Oct 2023 07:17:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8DCD83858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8DCD83858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697872684; cv=none; b=vvwJD8AOpmIizWX/utkcd7J96NBN6FPwwuTBTdQkQVMSotk3LurwIQT8juog8a8hGFWi6hIBZQ8mOaA5eIMhRShc43MUXijiTsmS0fHcLQbpBEocuEnAwhS8IxKvVWrkOMcdbCj2gEnny8AUusW4lGa1WMr711KUPQkIuHiwiFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697872684; c=relaxed/simple; bh=1lmXbmyJbQmYaTcj9+qu0zp6SDmz3SCwNcuVbAwjL00=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lqgORRfpML5BbS0eqgGwpS2sy/uKLvkqndL9DdBi30Ke/giMnx8Z3rGHnnRAx+bX5Mz0wcj46rBOGibb2yEyYhVjXDx5RNrxoNLV5bheYQnGhDD3yXbtZXCoPUR+GB/Ytm1NQ6L8uoKGPV+CwnsXhS4AsymGcKvwWv+ztwAbxVw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5a9bc2ec556so1028679a12.0 for <gcc-patches@gcc.gnu.org>; Sat, 21 Oct 2023 00:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1697872672; x=1698477472; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+GqWmuV2KLrOPYw1453/vCYBKPaY6N5Alhts4RA+iRU=; b=f3Z4SlF1WMkBKJ8RTwNKs3nmTtH2ZEwqMDuWQ1gsH8p0iu4be217cpp9VZJE5gXVSk otnMHGQSrlpBP1SC32YOAHw8/N1HjMdp2wkMOTP2mBdcv00XqVfM1J+AP+ZZyPSMUCXD Uv9hmIxmPBiPWKMLbXkZuDK0+6AQac7d7KjWcBBFUldcz6A5YEB9LrjWPXkNN1vISffS hiEpYVAl8U62SOY+mcbamP9SPjfyl7O6uel9tsmdjNJOnueSD/U/FspJ2xyXJ90RoN2X EkxVCM/SKaUgDrMJ4JNi4TeVVEnWh1uNshjcQsCrP9QG2fuhD1u5xy+pbUXOfM0jK/vm 2oNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697872672; x=1698477472; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+GqWmuV2KLrOPYw1453/vCYBKPaY6N5Alhts4RA+iRU=; b=np7mVDncsEdcpbt2rH5nmfyPqvXY1Wk/xFYYDaRAgPm+fcve5+nMONwnPQ8iup6YPJ 46c3VzsA3dnSmPVHJWXCUoAkdyyV8bBMrm+/dwvHvmCSsJQDxE5urRzGHf9LBJXIUAnG x1tYsan6QD2qKkf7KoS5AkoFdMelBBUbGapbqjUccjJ4w9DwYZ8L0P0rI/jiNhZ9ksDa +6LxjefQlJNQkQLI7ENFnfY1WNkaY/j6yOaBWDQ95mue9yey2oF6lhFebPz1HcktkoQX a1U8ooo/uG5c2czXOKj1eCuky6D3RaY0yOs3/fCxnUIloyp5Hu8Nnx93tCxezpabZFTx NsWw== X-Gm-Message-State: AOJu0Yz+nNKX/XYex0ycbivdQUFOyIpVjPWAmDCjWl/eyAO5h4BNd4Fe +tLZdRlhsYb7c+ramDqRFO2XAA== X-Received: by 2002:a17:902:e551:b0:1bc:3944:9391 with SMTP id n17-20020a170902e55100b001bc39449391mr3908634plf.25.1697872672113; Sat, 21 Oct 2023 00:17:52 -0700 (PDT) Received: from free.home ([2804:7f1:2080:9908:3d54:220a:ea84:c188]) by smtp.gmail.com with ESMTPSA id o2-20020a170902d4c200b001c61df93afdsm2569952plg.59.2023.10.21.00.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 00:17:51 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 39L7Ha6S1562943 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 21 Oct 2023 04:17:37 -0300 From: Alexandre Oliva <oliva@adacore.com> To: Richard Biener <richard.guenther@gmail.com> Cc: gcc-patches@gcc.gnu.org, hubicka@ucw.cz Subject: [PATCH] [PR111520] set hardcmp eh probs (was: rename make_eh_edges to make_eh_edge) Organization: Free thinker, does not speak for AdaCore References: <oredhrdowb.fsf@lxoliva.fsfla.org> <CAFiYyc2e74x-B-cmGeo58+zBuJ+-EKPJmA_tzGbnVNqfSx_ZEA@mail.gmail.com> <ory1fxbza4.fsf_-_@lxoliva.fsfla.org> <CAFiYyc1yAafbh=LJE8Cr9mmuFK8Q5f5oTuLu+5GXE1HdOuy8=A@mail.gmail.com> Date: Sat, 21 Oct 2023 04:17:36 -0300 In-Reply-To: <CAFiYyc1yAafbh=LJE8Cr9mmuFK8Q5f5oTuLu+5GXE1HdOuy8=A@mail.gmail.com> (Richard Biener's message of "Fri, 20 Oct 2023 08:34:34 +0200") Message-ID: <or1qdoculr.fsf_-_@lxoliva.fsfla.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_QUOTING 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780348574276163714 X-GMAIL-MSGID: 1780348574276163714 |
Series |
[PR111520] set hardcmp eh probs (was: rename make_eh_edges to make_eh_edge)
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Alexandre Oliva
Oct. 21, 2023, 7:17 a.m. UTC
On Oct 20, 2023, Richard Biener <richard.guenther@gmail.com> wrote: >> * tree-eh.h (make_eh_edges): Rename to... >> (make_eh_edge): ... this. >> * tree-eh.cc: Likewise. Adjust all callers. Once the above goes in (it depends on the strub monster patch), the following one should apply as well. Regstrapped on x86_64-linux-gnu. Ok to install? Set execution count of EH blocks, and probability of EH edges. for gcc/ChangeLog PR tree-optimization/111520 * gimple-harden-conditionals.cc (pass_harden_compares::execute): Set EH edge probability and EH block execution count. for gcc/testsuite/ChangeLog PR tree-optimization/111520 * g++.dg/torture/harden-comp-pr111520.cc: New. --- gcc/gimple-harden-conditionals.cc | 12 +++++++++++- .../g++.dg/torture/harden-comp-pr111520.cc | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc
Comments
On Sat, Oct 21, 2023 at 9:17 AM Alexandre Oliva <oliva@adacore.com> wrote: > > On Oct 20, 2023, Richard Biener <richard.guenther@gmail.com> wrote: > > >> * tree-eh.h (make_eh_edges): Rename to... > >> (make_eh_edge): ... this. > >> * tree-eh.cc: Likewise. Adjust all callers. > > Once the above goes in (it depends on the strub monster patch), the > following one should apply as well. Regstrapped on x86_64-linux-gnu. > Ok to install? OK. > Set execution count of EH blocks, and probability of EH edges. > > > for gcc/ChangeLog > > PR tree-optimization/111520 > * gimple-harden-conditionals.cc > (pass_harden_compares::execute): Set EH edge probability and > EH block execution count. > > for gcc/testsuite/ChangeLog > > PR tree-optimization/111520 > * g++.dg/torture/harden-comp-pr111520.cc: New. > --- > gcc/gimple-harden-conditionals.cc | 12 +++++++++++- > .../g++.dg/torture/harden-comp-pr111520.cc | 17 +++++++++++++++++ > 2 files changed, 28 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc > > diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc > index 1999e827a04ca..bded288985063 100644 > --- a/gcc/gimple-harden-conditionals.cc > +++ b/gcc/gimple-harden-conditionals.cc > @@ -580,11 +580,21 @@ pass_harden_compares::execute (function *fun) > if (throwing_compare_p) > { > add_stmt_to_eh_lp (asgnck, lookup_stmt_eh_lp (asgn)); > - make_eh_edge (asgnck); > + edge eh = make_eh_edge (asgnck); > + /* This compare looks like it could raise an exception, > + but it's dominated by the original compare, that > + would raise an exception first, so the EH edge from > + this one is never really taken. */ > + eh->probability = profile_probability::never (); > + if (eh->dest->count.initialized_p ()) > + eh->dest->count += eh->count (); > + else > + eh->dest->count = eh->count (); > > edge ckeh; > basic_block nbb = split_edge (non_eh_succ_edge > (gimple_bb (asgnck), &ckeh)); > + gcc_checking_assert (eh == ckeh); > gsi_split = gsi_start_bb (nbb); > > if (dump_file) > diff --git a/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc > new file mode 100644 > index 0000000000000..b4381b4d84ec4 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc > @@ -0,0 +1,17 @@ > +/* { dg-do compile } */ > +/* { dg-options "-fharden-compares -fsignaling-nans -fnon-call-exceptions" } */ > + > +struct S > +{ > + S (bool); > + ~S (); > +}; > + > +float f; > + > +void > +foo () > +{ > + S a = 0; > + S b = f; > +} > > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > More tolerance and less prejudice are key for inclusion and diversity > Excluding neuro-others for not behaving ""normal"" is *not* inclusive
diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc index 1999e827a04ca..bded288985063 100644 --- a/gcc/gimple-harden-conditionals.cc +++ b/gcc/gimple-harden-conditionals.cc @@ -580,11 +580,21 @@ pass_harden_compares::execute (function *fun) if (throwing_compare_p) { add_stmt_to_eh_lp (asgnck, lookup_stmt_eh_lp (asgn)); - make_eh_edge (asgnck); + edge eh = make_eh_edge (asgnck); + /* This compare looks like it could raise an exception, + but it's dominated by the original compare, that + would raise an exception first, so the EH edge from + this one is never really taken. */ + eh->probability = profile_probability::never (); + if (eh->dest->count.initialized_p ()) + eh->dest->count += eh->count (); + else + eh->dest->count = eh->count (); edge ckeh; basic_block nbb = split_edge (non_eh_succ_edge (gimple_bb (asgnck), &ckeh)); + gcc_checking_assert (eh == ckeh); gsi_split = gsi_start_bb (nbb); if (dump_file) diff --git a/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc new file mode 100644 index 0000000000000..b4381b4d84ec4 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-fharden-compares -fsignaling-nans -fnon-call-exceptions" } */ + +struct S +{ + S (bool); + ~S (); +}; + +float f; + +void +foo () +{ + S a = 0; + S b = f; +}