From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id A750E385781F for ; Mon, 23 Oct 2023 08:02:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A750E385781F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A750E385781F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698048165; cv=none; b=lJztSBVwDjmUY8pbQOnXVyJiK4Q3EPYv3ehQXfR5BE8525MWCdR7UD/vxySwgU07Nf42XVO8AHUc4YFD2xjrdmnQ7tG6jl4eWd01oWlzYc34vdQaGfvBELV5m+Dx1cJE8pt9ksSJjiii+e4SICTcD+6ArzP8xMeG665nn90LKzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698048165; c=relaxed/simple; bh=4o0F5BKkzPdv+P0ZZL+4Hkqhizii3TG2zVGTvGwtBzI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=tLwb6TmF1sJMQOuTwPfF2nPqIfquxa+aXgQCuAL+lbEN9/KjdF2E5ISYOlBYBaIKZKv3OXm1sjSjzcRSXHYjMfE5qJ83fRAIyUhvg0Mkn/TLbZXUTAEztCSlwWYjMIF9Vq/wSZOhdEPNCL7pKZekEUp0Me9zX7itwJZhJqNUnkA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-507a55302e0so3949038e87.0 for ; Mon, 23 Oct 2023 01:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698048162; x=1698652962; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UEaLXZI2Nxk68OUpNTMvllRkgnDjffgELtiNNHZFBiY=; b=LPsaBjiZUSLzWOY+5VIFgKTw+dbeHYX3ME35HVf8BqPMOz/c93Dysjqys1gEO+QwW+ vXW8Bb4ZxzCigbHqIfDKNVjKhvZ6IVitfN+jvcYl6bRPDxKWyehxdQBCsgMsl/yAHIA6 qOsP89qE0BX0+jlGYOV/1lQl8TBV+mAuauwe2a4x1zva2s8JfkmJSoM2PYb8NqXT55dj 1q7vHjkdHfNiwFJf5Vmt1dpk/EM4nY7UFcOwDpOmLEbAhsbVMHOAlQWT9PX15aTDAR2E QdHvwtltpS/4xe1plNEgsem9LDO5NEpyXia21NYGe7CmpozTNgHXhbkBAbrYpnnCqFr/ Au3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698048162; x=1698652962; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UEaLXZI2Nxk68OUpNTMvllRkgnDjffgELtiNNHZFBiY=; b=N+NSnWHfGg1L/XjYoK+S37DCaPD5Yq2W/4P1qcX12fFsMu6TXAt1Eq2MkSgBW+4jNU XI90XR81JewU/jChtTzlpR8Kgg1IeOrZ7i8gafWsaj2jLoaJpDQsEd4le+8DMP5IhiJy Vv3XbosWuBT/8X+UlocaUhZP38KSBXWCQVQJhgeUjT5iXvFu74yxRmTxnd+GGDPSs33m YtKUn/UsBwSnokeeT5yXzwr34TbsFuds6TJBgScDSoNyHIAszN6tXjBu8r47uPFkWGdq m+HXM4H+eSgh0tpgj+WQhhUWLVtwuTrw4XnEpSeOVrWkyYytVVgHLYSOsWbZnFl7JKbF scnA== X-Gm-Message-State: AOJu0YziWiq/KpNIQ/Ra/kMPu3HZAe+PlnIWTcQqwA9bv5pWyiLWynKh BYK17EZHWT0rNEVaCvM9od4BYvfU8LrKdosf9Yg= X-Google-Smtp-Source: AGHT+IE06SUztnK1gsLr1mpyTzjrOUOIcxOkXVNmc5P3GMAHtpSkokfpiArrHFu2BIxYFuaK2J5n5eBVsbs2bqiUsx8= X-Received: by 2002:a05:6512:554:b0:507:9a49:3f23 with SMTP id h20-20020a056512055400b005079a493f23mr5711559lfl.18.1698048161794; Mon, 23 Oct 2023 01:02:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 23 Oct 2023 09:59:37 +0200 Message-ID: Subject: Re: [PATCH] [PR111520] set hardcmp eh probs (was: rename make_eh_edges to make_eh_edge) To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org, hubicka@ucw.cz Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On Sat, Oct 21, 2023 at 9:17=E2=80=AFAM Alexandre Oliva = wrote: > > On Oct 20, 2023, Richard Biener 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-condit= ionals.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 =3D 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 =3D profile_probability::never (); > + if (eh->dest->count.initialized_p ()) > + eh->dest->count +=3D eh->count (); > + else > + eh->dest->count =3D eh->count (); > > edge ckeh; > basic_block nbb =3D split_edge (non_eh_succ_edge > (gimple_bb (asgnck), &ckeh)); > + gcc_checking_assert (eh =3D=3D ckeh); > gsi_split =3D gsi_start_bb (nbb); > > if (dump_file) > diff --git a/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc b/gcc/t= estsuite/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-exception= s" } */ > + > +struct S > +{ > + S (bool); > + ~S (); > +}; > + > +float f; > + > +void > +foo () > +{ > + S a =3D 0; > + S b =3D 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