From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DF623858016; Wed, 4 May 2022 10:46:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DF623858016 From: "christophm30 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105477] New: RISC-V: Regression: Useless moves in conditional select return Date: Wed, 04 May 2022 10:46:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: christophm30 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2022 10:46:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105477 Bug ID: 105477 Summary: RISC-V: Regression: Useless moves in conditional select return Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: christophm30 at gmail dot com Target Milestone: --- Commit 3a7ba8fd triggers a regression so that on RISC-V two useless move instructions are generated. Test code: """ long test(long a, long b, long c) { return (!c ? a : b); } """ GCC 10.2.0, GCC 11 or upstream/master before 3a7ba8fd generates (rv64gc + -= O3): test: beq a2,zero,.L2 mv a0,a1 .L2: ret Current upstream/master generates: : 0: 87aa mv a5,a0 2: 852e mv a0,a1 4: e211 bnez a2,8 <.L2> 6: 853e mv a0,a5 <.L2>: 8: 8082 ret This might be an issue in the ifcvt code (in combination of the RISC-V back= end) or something where the RISC-V backend needs to improve. Some context to this issue: * The mentioned change (3a7ba8fd) is not problematic at all and fixes an is= sue PR104960 * PR105314 reports a similar issue, that is also triggered by the same chan= ge=