https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64946
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to vekumar from comment #6) > (In reply to Andrew Pinski from comment #5) > > I think you should always use an unsigned type here so it will be defined in > > the IR. This is mentioned in bug 22199#c3 . > > Andrew I missed to include something like this > > + (if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) > + (convert (op @0 @1))) > > as in https://gcc.gnu.org/viewcvs?rev=220695&root=gcc&view=rev I did not miss that, I am just saying you should do it for types that have undefined overflow also but convert it into a type that wraps. Meaning you are not apply the full optimization really.