From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AB513858409; Fri, 14 Apr 2023 19:09:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AB513858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681499397; bh=5mJeaPxcfrD4yvcZzR0HJzAdHV0YC9eBfaQttNDr0yM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nNZZm/J/Kq0iyITSRaB1cnc4b0kwjDyCKBTvyY1boVGLyQFiQQqzqi2VCKjMmoS18 5W3l3mFpw4GZ5i0PM5c4oyRoEPAAc9nE6cfX27+JoEgMKtvR2MUpJ8X5djGmNREqtn kwaBZF2E91MwqG0oCOy56MP9O3fpjTBFxg/2C0Ok= From: "jakub 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: Fri, 14 Apr 2023 19:09:56 +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: 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: 13.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=3D109154 --- Comment #51 from Jakub Jelinek --- Dumb untested patch which saves 2 instructions from each of those testcases: --- gcc/tree-if-conv.cc.jj 2023-04-12 08:53:58.264496474 +0200 +++ gcc/tree-if-conv.cc 2023-04-14 21:02:42.403826690 +0200 @@ -2071,7 +2071,7 @@ predicate_scalar_phi (gphi *phi, gimple_ } /* Put element with max number of occurences to the end of ARGS. */ - if (max_ind !=3D -1 && max_ind +1 !=3D (int) args_len) + if (max_ind !=3D -1 && max_ind + 1 !=3D (int) args_len) std::swap (args[args_len - 1], args[max_ind]); /* Handle one special case when number of arguments with different values @@ -2116,12 +2116,12 @@ predicate_scalar_phi (gphi *phi, gimple_ vec *indexes; tree type =3D TREE_TYPE (gimple_phi_result (phi)); tree lhs; - arg1 =3D args[1]; - for (i =3D 0; i < args_len; i++) + arg1 =3D args[args_len - 1]; + for (i =3D args_len - 1; i > 0; i--) { - arg0 =3D args[i]; - indexes =3D phi_arg_map.get (args[i]); - if (i !=3D args_len - 1) + arg0 =3D args[i - 1]; + indexes =3D phi_arg_map.get (args[i - 1]); + if (i !=3D 1) lhs =3D make_temp_ssa_name (type, NULL, "_ifc_"); else lhs =3D res;=