https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110539
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > yes adding: > /* (convert)(zeroone != 0) into (convert)zeroone */ > /* (convert)(zeroone == 0) into ((convert)zeroone)^1 */ > (for neeq (ne eq) > (simplify > (convert (neeq zero_one_valued_p@0 integer_zerop)) > (if (neeq == NE_EXPR) > (convert @0) > (bit_xor (convert @0) { build_one_cst (type); } )))) > > > Fixes the original testcase. One simple regression: /* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 1;" 1 "dom3"} } */ /* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 0;" 1 "dom3"} } */ fail now but that is they just don't match the above on accident. Before: Replaced 'bufferstep_36' with constant '0' gimple_simplified to _5 = 1; Folded to: _5 = 1; After: Replaced 'bufferstep_36' with constant '0' gimple_simplified to bufferstep_23 = 1; Folded to: bufferstep_23 = 1;