https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126257
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:e68da97a85daabd9b48edb22aa27592cb06aa576 commit r15-11380-ge68da97a85daabd9b48edb22aa27592cb06aa576 Author: Jakub Jelinek <[email protected]> Date: Wed Jul 15 10:27:56 2026 +0200 match.pd: Guard x+x -> x*2 simplification [PR126257] The x+x -> x*2 simplication obviously requires that 2 is representable in type, so that rules out unsigned _BitInt(1) and signed _BitInt(2) (and 1 too in C2Y, ditto unsigned:1 and signed:2 and :1), otherwise we don't multiply by 2 but by 0 or -2. While perhaps we could transform in those cases x+x to x<<1, I'm not convinced it is worth it. 2026-07-15 Jakub Jelinek <[email protected]> PR tree-optimization/126257 * match.pd (x+x -> x*2): Only optimize if 2 is representable in the type. * gcc.dg/torture/bitint-101.c: New test. Reviewed-by: Richard Biener <[email protected]> (cherry picked from commit d5059b35e03e63c7686288c3554c2922a2c37468)
