From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1D5793858025; Thu, 4 Jan 2024 16:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D5793858025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704386118; bh=XOd4uac1ptKIrET2jTpdnGrfSaZpeQN7WGQtTVKHozo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mDtHmBBpQRp9nd6pwRJTRMX5ecgbTvYNz/Y4Z0vLJ+2ghskOHzJ4uvTBAc/md70Jb fuVdx+1oMYVruTXw8X46V3cnW0VZvQa19iVlSkmUUA0cXY2xHdsVVzfV29HSGNOCdp +gZNkyNKMWnL4sjQvP/g0Ei6D2XT69fHcmesWkO0= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110852] [14 Regression] ICE: in get_predictor_value, at predict.cc:2695 with -O -fno-tree-fre and __builtin_expect() since r14-2219-geab57b825bcc35 Date: Thu, 04 Jan 2024 16:35:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110852 --- Comment #12 from Jakub Jelinek --- (In reply to Jan Hubicka from comment #11) > I added the early exits to handle the following case. >=20 > a =3D b * c >=20 > If b is prediced to 0 with predictor1, while c is predicted to 1 with > predictor2 your version will predict a to be 0, but will merge > predictor1 and 2 leading to lower probability than predictor1 alone. > So the early exit will give bit higher chance for not losing > information. I thought the goal was to handle what is in predict-18.c, i.e. b * __builtin_expect (c, 0) or similar. If it is about __builtin_expect_with_probability (b, 42, 0.25) * __builtin_expect_with_probability (c, 0, 0.42) sure, my version will merge the probabilities, while you'll pick the probability from the 0 case.=