From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C9D838582AD; Thu, 4 Jan 2024 17:06:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C9D838582AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704388018; bh=JkaCdUw7bIjzzoQ7LqEOj7W61JTqNsv/vlaB5zHNPmA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Zwo3zAmKTovasrmeU0Ew0w3CvZ1RZZkv6u3hCvIUmnEt7cHRtgWW9FVDlU/DiyvUz mOkjqpxqI4XY027uaE4OJOLf7DaKt34wrjj9RLQH+9Yj0MEvHMSVAb/XMCqkQ+8LHN 0cCriSFhoPTgtBfZ9HxyU1gxrjULZsINgSo2f70o= From: "hubicka at ucw dot cz" 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 17:06:57 +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: hubicka at ucw dot cz 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 #14 from Jan Hubicka --- > 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. Probability from 0 case is better estimate, so I think it makes sense to handle it right. I did not take that much stats on how often it happens, but on my TODO list is to turn this into value range predictor which may have better chance of success. We can also handle other constants than INTEGER_CST. I will see if I can clean up the code bit more or add a comment, since it is indeed bit confusing as written now. Will also look into more testcases. Thanks a lot! Honza=