From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB6AD3858422; Fri, 4 Nov 2022 08:30:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB6AD3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667550653; bh=+EsJTVldFOlZ/zvdJR58KE3/moI5S9TDCuhW/Fu+ikI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CWUXcskRk11mdf57vZIMYcYJVdpTPvS7sA3FCsHEazRWXBiOEUNRl+UNnj+nxpBGP d/WGLl+EAlg9QTvDwFFSZvICGDxmCOzunm5sjebn2iTwRGc+28bmcM/icpYJOOQ8by 7OgZsgmuRSdYJoxGKhkfFlaQqAM+QmT+whPb35rs= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/106032] [10/11 Regression] wrong code at -Os and above on x86_64-linux-gnu Date: Fri, 04 Nov 2022 08:30:34 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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=3D106032 --- Comment #14 from CVS Commits --- The releases/gcc-11 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:fe6e8a09a5338c0acda23ab2d3ef4433fb83637f commit r11-10354-gfe6e8a09a5338c0acda23ab2d3ef4433fb83637f Author: Jakub Jelinek Date: Tue Jun 21 11:40:16 2022 +0200 ifcvt: Don't introduce trapping or faulting reads in noce_try_sign_mask [PR106032] noce_try_sign_mask as documented will optimize if (c < 0) x =3D t; else x =3D 0; into x =3D (c >> bitsm1) & t; The optimization is done if either t is unconditional (e.g. for x =3D t; if (c >=3D 0) x =3D 0; ) or if it is cheap. We already check that t doesn't have side-effects, but if t is conditional, we need to punt also if it may trap or fault, as we make it unconditional. I've briefly skimmed other noce_try* optimizations and didn't find one = that would suffer from the same problem. 2022-06-21 Jakub Jelinek PR rtl-optimization/106032 * ifcvt.c (noce_try_sign_mask): Punt if !t_unconditional, and t may_trap_or_fault_p, even if it is cheap. * gcc.c-torture/execute/pr106032.c: New test. (cherry picked from commit a0c30fe3b888f20215f3e040d21b62b603804ca9)=