From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 748EC3858C36; Wed, 22 Nov 2023 09:28:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 748EC3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700645320; bh=VbO8ve/4HJDTJdNxWZm1iwcP0pCathNU7N4HmQohT2Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bba8iECJtSdFyki74Yj9ty9ZYzR4iQx9+JHsoCF4LZ8+mNaAhll8Z3moyB8IaFY0U gtYOslEYiVEfvKxsVPl8qdgHuPzgrrHis1aJmxmWBJVnE8FbgGfr5YxYdbjwI6JHoS X5cCL9Ml+qOitBS/42n0nh7Pqwz3X38+8x29xmiY= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/112657] [13/14 Regression] missed optimization: cmove not used with multiple returns Date: Wed, 22 Nov 2023 09:28:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com 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.3 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=3D112657 --- Comment #4 from Uro=C5=A1 Bizjak --- (In reply to Uro=C5=A1 Bizjak from comment #3) > (In reply to Andrew Pinski from comment #2) >=20 > > Someone will have to debug ifcvt.cc to see why it fails on x86_64 but w= orks > > on aarch64. Note there are some new changes to ifcvt.cc in review which > > might improve this, though I am not sure. >=20 > x86_64 targetm.noce_conversion_profitable_p returns false for: Actually, the cost function goes to default_noce_conversion_profitable_p, where: (gdb) p cost $1 =3D 16 (gdb) p if_info->original_cost=20 $2 =3D 8 (gdb) p if_info->max_seq_cost=20 $3 =3D 0 For some reason, max_seq_cost remains zero, while on aarch64: (gdb) p cost $2 =3D 12 (gdb) p if_info->original_cost $3 =3D 8 (gdb) p if_info->max_seq_cost $4 =3D 12 So, x86_64 returns false from the default cost function: /* When compiling for size, we can make a reasonably accurately guess at the size growth. When compiling for speed, use the maximum. */ return speed_p && cost <=3D if_info->max_seq_cost;=