https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102703
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 51613 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51613&action=edit Current patchset which I am testing Here is my current patch set which fixes this. It is 4 patches. The first three are either adding dumping info or cleanup of the code. The 4th is the one which does the optimization.