https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96779
navidrahimi <navidrahimi at microsoft dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |navidrahimi at microsoft dot com --- Comment #4 from navidrahimi <navidrahimi at microsoft dot com> --- Hi Andrew, I just used your code and added a check to check whether the type is wrapping type: (for cmp (eq ne) (simplify (cmp:c @0 (negate @0)) (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) && !TYPE_OVERFLOW_WRAPS (type)) (cmp:c @0 { build_zero_cst (TREE_TYPE(@0)); }))))) This should work.