https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107137
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:e6bcf83989478348428c732c11e6c0f1719e9214 commit r14-3721-ge6bcf83989478348428c732c11e6c0f1719e9214 Author: Andrew Pinski <apin...@marvell.com> 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, might 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.