https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83022
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 61040 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61040&action=edit Patch which needs some comments but is lightly tested and seems to work This also needs testcases but the patch fixes the performance issue here. Note it is on top of the patch for PR 87900 since that needs the similar code too.