https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 59065 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59065&action=edit Patch which moves this folding to a different location So in the end, it is better to move this optimization to fold_stmt. For branches my original patch seems like the best.