https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109834
--- Comment #12 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:99488a6048745a7b999c22f46e5814d02ebf88d9 commit r14-804-g99488a6048745a7b999c22f46e5814d02ebf88d9 Author: Andrew Pinski <apin...@marvell.com> Date: Fri May 12 16:33:44 2023 -0700 MATCH: Fix PR 109834, ICE with popcount combined with bswap After r14-673-gc0dd80e4c4c3, there was a check in the match patterns which was checking the type is unsigned but instead of using the type, the patch used the expression. This adds the needed TREE_TYPE so get the correct answer and don't ICE. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/109834 gcc/ChangeLog: * match.pd (popcount(bswap(x))->popcount(x)): Fix up unsigned type checking. (popcount(rotate(x,y))->popcount(x)): Likewise. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr109834-1.c: New test. * gcc.dg/tree-ssa/pr109834-1.c: New test.