https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87901
--- Comment #8 from GCC 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:800b3977031dd4f14d09ced975276e09457dfff7 commit r16-25-g800b3977031dd4f14d09ced975276e09457dfff7 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Mon Apr 7 17:06:17 2025 -0700 DSE: Support triming of some more memset [PR87901] DSE has support for trimming memset (and memset like) statements. In this case we have `MEM <unsigned char[17]> [(char * {ref-all})&z] = {};` in the IR and when we go to trim it, we call build_fold_addr_expr which leaves around a cast from one pointer type to another. This is due to build_fold_addr_expr being generic but in gimple you don't need these casts. PR tree-optimization/87901 gcc/ChangeLog: * tree-ssa-dse.cc (maybe_trim_constructor_store): Strip over useless type conversions after taking the address of the MEM_REF. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/ssa-dse-52.c: New test. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>