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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1) 
> Andrew, before I close this bug, would you like to shed some light on what
> you had in mind here?  What sort of a resolution are you looking for?

So the reason why I said it was dead is because:
TREE_CODE (lhs) == COMPONENT_REF
&& (TREE_CODE (rhs) == BIT_IOR_EXPR
    || TREE_CODE (rhs) == BIT_AND_EXPR)

Can never be true after gimplification.

What this optimization is trying to do is the following:

struct f{
  int i0:1;
  int i1:1;
};

void or0(struct f *a)
{
  a->i0 = a->i0 | a->i1;
}
into:
void or1(struct f *a)
{
  if (a->i1 != 0)
    a->i0 = 1;
}

And:

void and0(struct f *a)
{
  a->i0 = a->i0 & a->i1;
}
into:
void and0(struct f *a)
{
  if (a->i1 == 0)
    a->i0 = 0;
}

------ CUT -----

Now this optimization has been disabled for ~8 years now and it might be better
if just removed.

Reply via email to