https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105749

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
At -O1 we have in forwprop2:
```
  # RANGE [irange] unsigned char [0, 1] MASK 0x1 VALUE 0x0
  # SR.2723_39 = PHI <1(45), 0(44)>
  _30 = VIEW_CONVERT_EXPR<bool>(SR.2723_39);
  if (_30 != 0)

...
  # RANGE [irange] unsigned char [0, 1] MASK 0x1 VALUE 0x0
  # port$4_41 = PHI <0(46), 1(47)>
...
  _36 = VIEW_CONVERT_EXPR<bool>(port$4_41);
  if (_36 != 0)
```

So we could just do:
```
(for neeq (ne eq)
 (simplify
  (neeq (view_convert@0 zero_one_valued_p@1) integer_zerop)
  (if (TREE_CODE (TREE_TYPE (@0)) == BOOLEAN_TYPE
       && TYPE_PRECISION (TREE_TYPE (@0)) == 1
       && TYPE_UNSIGNED (TREE_TYPE (@0)))
   (neeq @1 { build_zero_cst (TREE_TYPE (@1)); } ))))
```

This will catch all of the issues here and should be not as controversial as
the patch I had sent before.

Reply via email to