From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8AF3B385771C; Tue, 5 Sep 2023 21:16:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AF3B385771C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693948577; bh=ejS/mMFjN+KjZg7k5PrwEv/yxaKwxicKILMQ/WGGv/0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kr3XyCLMPMyDCemtIxbW54OQ/qSVc637VE4tpuszXN7icXwSGRoeF+m8MKRVx/JNa XwId1zBzxxzABPOxWF2qTXP9c9qcZ+/nbtr+W5I+j/F33sV4Rh51kHlaQQ3C+ZvrIa wH3Ko2QzZlZtD7doLngGN4BebYhrct5I1FFzZyes= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107137] (unsigned)-(int)(bool_var) should be optimized to -(unsigned)bool_var Date: Tue, 05 Sep 2023 21:16:17 +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: 12.0 X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit 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: --- 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=3D107137 --- Comment #6 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:e6bcf83989478348428c732c11e6c0f1719e9214 commit r14-3721-ge6bcf83989478348428c732c11e6c0f1719e9214 Author: Andrew Pinski Date: Thu Aug 31 16:17:35 2023 -0700 MATCH: `(nop_convert)-(convert)a` into -(convert)a if we are converting from something smaller This allows removal of one conversion and in the case of booleans, migh= t be able to remove the negate and the other conversion later on. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/107137 gcc/ChangeLog: * match.pd (`(nop_convert)-(convert)a`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/neg-cast-2.c: New test. * gcc.dg/tree-ssa/neg-cast-3.c: New test.=