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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot 
gnu.org

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually we should be able to convert:

  # RANGE [irange] int [0, 1] MASK 0x1 VALUE 0x0
  _2 = 1 >> b.1_1;


Into:
 `b.1_1 == 0`

as b.1_1 since the only value that gives out 1 that is defined is 0.

That might solve it too.

Since if we had that, then:
  _t = b.1_1 == 0;
  _2 = (int)_t;
  iftmp.0_9 = (char) _2;
  _3 = (unsigned int) _2;
  b = _3;
  _4 = iftmp.0_9 ^ 1;
  _22 = (short int) _4;
  _5 = (short int) _2;
  if (_5 == _22)

and then:

_t1 = b.1_1 != 0;
_4 = (char) _t1;
_22 = (short int)_t1;
_2 = (short int)_t;

And then _t1 == _t1 which gives false.

So maybe:
/* `1 >> x` can be "simplified" into `(convert)x == 0`. */
(simplify
 (rshift integer_onep @2)
 (if (INTEGRAL_TYPE_P (type))
  (convert (eq:boolean_type_node @2 { build_zero_cst (type); }))))

Reply via email to