https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120074
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 61278 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61278&action=edit gimple testcase Compile with -O1 -fgimple. The reason for the special flags before is because _5 = _4 & 3; if (_5 < 0) is always false. I am not 100% sure this will happen ever without the special flags. -fno-tree-ccp is needed because it does bitwise range info and (a&3) well unsets the sign bit. -fno-tree-forwprop is needed because `non-negative<0` is matched. -fno-tree-copy-prop is similar to -fno-tree-forwprop. Uses fold which then does the backtrace to see non-negativeness.