From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BAAF3858C36; Mon, 27 Nov 2023 23:34:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BAAF3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701128083; bh=DNkfFlYxJbwJ9DihbLdMDfpn2jgn19HFSvg8YSEbRzk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AC9JtSyswWPebXmip0258vuI9Ap0uceG20OOIX6HOpTD2+xzf5KNKPE0f1iqs4pSh Twt2Y79yKpJQ38/3nji/Zg3aA7jiyKSVR9DG+h0vKnnuqEYELa5MLcaGTA02G2OvyO AnYTMnbvQD7WfAqZMhrBOOCJ+JHpmdvwyRgAuzgw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112738] [14 Regression] forwprop4 introduces invalid wide signed Boolean values Date: Mon, 27 Nov 2023 23:34:43 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D112738 --- Comment #2 from Andrew Pinski --- This is what I will be testing: ``` /* (nop_outer_cast)-(inner_cast)var -> -(outer_cast)(var) if var is smaller in precision. This is always safe for both doing the negative in signed or unsigned as the value for undefined will not show up. Note the outer cast cannot be a boolean type as the only valid values are 0,-1/1 (depending on the signedness of the boolean) and the negative is there to get the correct value. */ (simplify (convert (negate:s@1 (convert:s @0))) (if (INTEGRAL_TYPE_P (type) && tree_nop_conversion_p (type, TREE_TYPE (@1)) && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (@0)) && TREE_CODE (type) !=3D BOOLEAN_TYPE) (negate (convert @0)))) ``` It even records on why boolean check is needed.=