From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61C1B3858439; Wed, 22 Mar 2023 10:20:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61C1B3858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679480454; bh=1qwpMuOXQ+9ODDaKubw4EgOXhCmGXGCurHwIpHulqng=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z/xgLEI4o86oj6elSCcaV0fZ7NNL0A2ICWM4eHi16xDw1gloIgX3Z62kMzyK+HZsK JrfSVfi7d8mVyX4UcNAwOu0aqDeoowVkzHQNulk2zpyRmjV3TRSrCwftE5FCalQAX3 2jFOC1BX0RionfV5F7C8QgptPNHj881j2NNT5spQ= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109154] [13 regression] jump threading de-optimizes nested floating point comparisons Date: Wed, 22 Mar 2023 10:20:53 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D109154 Aldy Hernandez changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amacleod at redhat dot com, | |law at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #4 from Aldy Hernandez --- (In reply to Tamar Christina from comment #3) > Aldy, any thoughts here? We need a "real" threading expert on this one, as the decision by ranger is correct. It looks like this is a profitability issue in the threader. The problem can be seen with -O2 --param=3Dthreader-debug=3Dall, on the thr= eadfull1 dump: The threaded path is: path: 4->5->7 SUCCESS ranger can fold the conditional in BB5: if (_1 < 1.0e+0) goto ; [41.00%] else goto ; [59.00%] ...because on entry to BB5 we know _1 < 0.0: [local count: 955630225]: _1 =3D (float) l_9; _2 =3D _1 < 0.0; zone1_15 =3D (int) _2; if (_1 < 0.0) goto ; [41.00%] else goto ; [59.00%] [local count: 391808389]: [local count: 955630225]: # iftmp.0_10 =3D PHI fasten_main_natpro_chrg_init.2_3 =3D fasten_main_natpro_chrg_init; _4 =3D fasten_main_natpro_chrg_init.2_3 * iftmp.0_10; _5 =3D (float) _4; if (_1 < 1.0e+0) goto ; [41.00%] else goto ; [59.00%] If this shouldn't be threaded because of a hot/cold issue, perhaps the code goes in back_threader_profitability::profitable_path_p() where there's alre= ady logic wrt hot blocks.=